This commit is contained in:
2021-08-05 17:41:21 +02:00
parent 074178848e
commit d3bbb50fc8
2 changed files with 50 additions and 2 deletions

View File

@ -488,3 +488,47 @@ TEST_CASE("gainmode", "[.cmd]") {
REQUIRE_THROWS(proxy.Call("gainmode", {}, -1, GET));
}
}
TEST_CASE("filtercell", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) {
// chip version 1.1
if (det.getChipVersion().squash() * 10 == 11) {
auto prev_val = det.getFilterCell().tsquash(
"inconsistent #additional storage cells to test");
{
std::ostringstream oss;
proxy.Call("filtercell", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 1\n");
}
{
std::ostringstream oss;
proxy.Call("filtercell", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 15\n");
}
{
std::ostringstream oss;
proxy.Call("filtercell", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 0\n");
}
{
std::ostringstream oss;
proxy.Call("filtercell", {}, -1, GET, oss);
REQUIRE(oss.str() == "filtercell 0\n");
}
REQUIRE_THROWS(proxy.Call("filtercell", {"16"}, -1, PUT));
det.setFilterCell(prev_val);
}
// chip version 1.0
else {
// cannot set/get filter cell
REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
}
} else {
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT));
}
}