mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
master tests
This commit is contained in:
parent
dd8aebb0ab
commit
b6d63a8381
@ -472,14 +472,15 @@ int readConfigFile() {
|
|||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ignoreConfigFileFlag) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
// if not found in config file, they will be reset to hardware settings
|
// if not found in config file, they will be reset to hardware settings
|
||||||
top = -1;
|
top = -1;
|
||||||
master = -1;
|
master = -1;
|
||||||
#endif
|
#endif
|
||||||
if (ignoreConfigFileFlag) {
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int fileNameSize = 128;
|
const int fileNameSize = 128;
|
||||||
char fname[fileNameSize];
|
char fname[fileNameSize];
|
||||||
|
@ -570,6 +570,46 @@ TEST_CASE("fliprows", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("master", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2) {
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("master", {}, -1, GET));
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
// get previous master
|
||||||
|
int prevMaster = 0;
|
||||||
|
{
|
||||||
|
auto previous = det.getMaster();
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
if (previous[i] == 1) {
|
||||||
|
prevMaster = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss1;
|
||||||
|
proxy.Call("master", {"0"}, 0, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "master 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss1;
|
||||||
|
proxy.Call("master", {"1"}, 0, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "master 1\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("master", {"1"}, -1, PUT));
|
||||||
|
// set all to slaves, and then master
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setMaster(0, {i});
|
||||||
|
}
|
||||||
|
det.setMaster(1, prevMaster);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("master", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
// acquire: not testing
|
// acquire: not testing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user