test case fix for moduleid and serialnumber

This commit is contained in:
2021-09-15 10:19:16 +02:00
parent df2d0524a5
commit dbc541b4ea

View File

@ -104,30 +104,25 @@ TEST_CASE("detectorserverversion", "[.cmd]") {
TEST_CASE("serialnumber", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("serialnumber", {}, -1, GET));
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER) {
REQUIRE_THROWS(proxy.Call("serialnumber", {}, -1, GET));
} else {
REQUIRE_NOTHROW(proxy.Call("serialnumber", {}, -1, GET));
}
}
// TEST_CASE("moduleid", "[.cmd]") {
// Detector det;
// CmdProxy proxy(&det);
// if (det.getDetectorType().squash() == defs::GOTTHARD2) {
// auto prev_val = det.getModuleId();
// REQUIRE_NOTHROW(proxy.Call("moduleid", {}, -1, GET));
// std::ostringstream oss1, oss2, oss3;
// proxy.Call("moduleid", {"0x5d"}, -1, PUT, oss1);
// REQUIRE(oss1.str() == "moduleid 0x5d\n");
// proxy.Call("moduleid", {}, -1, GET, oss2);
// REQUIRE(oss2.str() == "moduleid 0x5d\n");
// proxy.Call("moduleid", {"0xffff"}, -1, PUT, oss3);
// REQUIRE(oss3.str() == "moduleid 0xffff\n");
// REQUIRE_THROWS(proxy.Call("moduleid", {"65536"}, -1, PUT));
// for (int i = 0; i != det.size(); ++i) {
// det.setModuleId(prev_val[i], {i});
// }
// } else {
// REQUIRE_THROWS(proxy.Call("moduleid", {"0"}, -1, GET));
// }
// }
TEST_CASE("moduleid", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3 ||
det_type == defs::EIGER) {
REQUIRE_NOTHROW(proxy.Call("moduleid", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("moduleid", {}, -1, GET));
}
}
TEST_CASE("type", "[.cmd]") {
Detector det;