mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
formatting
This commit is contained in:
@ -24,7 +24,8 @@ TEST_CASE("CALLER::dacname", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
|
||||
std::string str_dac_index = "2";
|
||||
auto prev = det.getDacName(ind);
|
||||
@ -58,7 +59,8 @@ TEST_CASE("CALLER::dacindex", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
|
||||
std::string str_dac_index = "2";
|
||||
|
||||
@ -83,7 +85,8 @@ TEST_CASE("CALLER::adclist", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev = det.getAdcNames();
|
||||
|
||||
REQUIRE_THROWS(caller.call("adclist", {"a", "s", "d"}, -1, PUT));
|
||||
@ -115,7 +118,8 @@ TEST_CASE("CALLER::adcname", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
int ind = 2;
|
||||
std::string str_adc_index = "2";
|
||||
auto prev = det.getAdcName(ind);
|
||||
@ -149,7 +153,8 @@ TEST_CASE("CALLER::adcindex", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
int ind = 2;
|
||||
std::string str_adc_index = "2";
|
||||
|
||||
@ -174,7 +179,8 @@ TEST_CASE("CALLER::signallist", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev = det.getSignalNames();
|
||||
|
||||
REQUIRE_THROWS(caller.call("signallist", {"a", "s", "d"}, -1, PUT));
|
||||
@ -206,7 +212,8 @@ TEST_CASE("CALLER::signalname", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
int ind = 2;
|
||||
std::string str_signal_index = "2";
|
||||
auto prev = det.getSignalName(ind);
|
||||
@ -240,7 +247,8 @@ TEST_CASE("CALLER::signalindex", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
int ind = 2;
|
||||
std::string str_signal_index = "2";
|
||||
|
||||
@ -266,7 +274,8 @@ TEST_CASE("CALLER::powerlist", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev = det.getPowerNames();
|
||||
|
||||
REQUIRE_THROWS(caller.call("powerlist", {"a", "s", "d"}, -1, PUT));
|
||||
@ -298,7 +307,8 @@ TEST_CASE("CALLER::powername", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
||||
std::string str_power_index = "2";
|
||||
auto prev = det.getPowerName(ind);
|
||||
@ -332,7 +342,8 @@ TEST_CASE("CALLER::powerindex", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
||||
std::string str_power_index = "2";
|
||||
|
||||
@ -382,7 +393,8 @@ TEST_CASE("CALLER::slowadclist", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev = det.getSlowADCNames();
|
||||
|
||||
REQUIRE_THROWS(caller.call("slowadclist", {"a", "s", "d"}, -1, PUT));
|
||||
@ -414,7 +426,8 @@ TEST_CASE("CALLER::slowadcname", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
|
||||
std::string str_slowadc_index = "2";
|
||||
auto prev = det.getSlowADCName(ind);
|
||||
@ -449,7 +462,8 @@ TEST_CASE("CALLER::slowadcindex", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
|
||||
std::string str_slowadc_index = "2";
|
||||
|
||||
@ -478,13 +492,15 @@ TEST_CASE("CALLER::dac", "[.cmdcall][.dacs]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
for (int i = 0; i < 18; ++i) {
|
||||
SECTION("dac " + std::to_string(i)) {
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
test_dac_caller(static_cast<defs::dacIndex>(i), "dac", 0);
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("dac", {std::to_string(i)}, -1, GET));
|
||||
REQUIRE_THROWS(
|
||||
caller.call("dac", {std::to_string(i)}, -1, GET));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ TEST_CASE("Caller::patfname", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(caller.call("patfname", {}, -1, PUT));
|
||||
REQUIRE_NOTHROW(caller.call("patfname", {}, -1, GET));
|
||||
} else {
|
||||
@ -35,7 +36,8 @@ TEST_CASE("Caller::pattern", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
// no proper test for put
|
||||
REQUIRE_THROWS(caller.call("pattern", {}, -1, GET));
|
||||
} else {
|
||||
@ -47,7 +49,8 @@ TEST_CASE("Caller::savepattern", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(
|
||||
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
|
||||
if (det.size() == 1) {
|
||||
@ -108,7 +111,8 @@ TEST_CASE("Caller::patword", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
int addr = 0x23;
|
||||
std::string saddr = ToStringHex(addr, 4);
|
||||
auto prev_val = det.getPatternWord(addr);
|
||||
@ -149,7 +153,8 @@ TEST_CASE("Caller::patlimits", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(-1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -175,7 +180,8 @@ TEST_CASE("Caller::patloop", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -223,7 +229,8 @@ TEST_CASE("Caller::patnloop", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -268,7 +275,8 @@ TEST_CASE("Caller::patwait", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -313,7 +321,8 @@ TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -358,7 +367,8 @@ TEST_CASE("Caller::patmask", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -383,7 +393,8 @@ TEST_CASE("Caller::patsetbit", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternBitMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -177,7 +177,8 @@ TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") {
|
||||
}
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::CHIPTESTBOARD && det_type != defs::MOENCH) {
|
||||
// 0 missing packets (takes into account that acquisition is stopped)
|
||||
// 0 missing packets (takes into account that acquisition is
|
||||
// stopped)
|
||||
det.startReceiver();
|
||||
det.startDetector();
|
||||
det.stopDetector();
|
||||
@ -236,8 +237,8 @@ TEST_CASE("Caller::rx_hostname", "[.cmdcall][.rx]") {
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getRxHostname();
|
||||
|
||||
// Cannot set rx_hostname (will reset parameters in rxr and no shm variables
|
||||
// to update)
|
||||
// Cannot set rx_hostname (will reset parameters in rxr and no shm
|
||||
// variables to update)
|
||||
// {
|
||||
// // disable receiver
|
||||
// std::ostringstream oss;
|
||||
@ -597,20 +598,21 @@ TEST_CASE("Caller::rx_roi", "[.cmdcall]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT, oss);
|
||||
caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT,
|
||||
oss);
|
||||
REQUIRE(oss.str() == "rx_roi [10, 22, 18, 19]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_roi",
|
||||
{"1", std::to_string(detsize.x - 5), "1",
|
||||
std::to_string(detsize.y - 5)},
|
||||
std::to_string(detsize.y - 5)},
|
||||
-1, PUT, oss);
|
||||
REQUIRE(oss.str() == std::string("rx_roi [1, ") +
|
||||
std::to_string(detsize.x - 5) +
|
||||
std::string(", 1, ") +
|
||||
std::to_string(detsize.y - 5) +
|
||||
std::string("]\n"));
|
||||
std::to_string(detsize.x - 5) +
|
||||
std::string(", 1, ") +
|
||||
std::to_string(detsize.y - 5) +
|
||||
std::string("]\n"));
|
||||
}
|
||||
REQUIRE_THROWS(
|
||||
caller.call("rx_roi", {"-1", "-1", "-1", "-1"}, -1, PUT));
|
||||
@ -966,7 +968,6 @@ TEST_CASE("Caller::rx_zmqstartfnum", "[.cmdcall][.rx]") {
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("rx_zmqstartfnum", {}, -1, GET));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -992,18 +993,18 @@ TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_zmqport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) +
|
||||
'\n');
|
||||
REQUIRE(oss.str() ==
|
||||
"rx_zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) + '\n');
|
||||
}
|
||||
port = 30001;
|
||||
caller.call("rx_zmqport", {std::to_string(port)}, -1, PUT);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_zmqport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) +
|
||||
'\n');
|
||||
REQUIRE(oss.str() ==
|
||||
"rx_zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) + '\n');
|
||||
}
|
||||
test_valid_port_caller("rx_zmqport", {}, -1, PUT);
|
||||
test_valid_port_caller("rx_zmqport", {}, 0, PUT);
|
||||
@ -1053,8 +1054,8 @@ TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val =
|
||||
det.getRxZmqHwm().tsquash("Inconsistent values for rx_zmqhwm to test");
|
||||
auto prev_val = det.getRxZmqHwm().tsquash(
|
||||
"Inconsistent values for rx_zmqhwm to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_zmqhwm", {"50"}, -1, PUT, oss);
|
||||
@ -1155,14 +1156,16 @@ TEST_CASE("Caller::rx_jsonaddheader", "[.cmdcall][.rx]") {
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"},
|
||||
-1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||
caller.call("rx_jsonaddheader",
|
||||
{"key1", "value1", "key2", "value2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() ==
|
||||
"rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("rx_jsonaddheader", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||
REQUIRE(oss.str() ==
|
||||
"rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -179,7 +179,8 @@ TEST_CASE("CALLER::settingslist", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_THROWS(caller.call("settingslist", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_NOTHROW(caller.call("settingslist", {}, -1, GET));
|
||||
@ -829,8 +830,8 @@ TEST_CASE("CALLER::exptime", "[.cmdcall][.time]") {
|
||||
if (det_type != defs::MYTHEN3) {
|
||||
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
|
||||
} else {
|
||||
auto t =
|
||||
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
||||
auto t = det.getExptimeForAllGates().tsquash(
|
||||
"inconsistent exptime to test");
|
||||
if (t[0] != t[1] || t[1] != t[2]) {
|
||||
throw RuntimeError("inconsistent exptime for all gates");
|
||||
}
|
||||
@ -1430,7 +1431,7 @@ TEST_CASE("CALLER::highvoltage", "[.cmdcall]") {
|
||||
}
|
||||
// range 0, 60 - 200
|
||||
else if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
|
||||
det_type == defs::CHIPTESTBOARD) {
|
||||
det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_THROWS(caller.call("highvoltage", {"50"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
@ -2001,7 +2002,8 @@ TEST_CASE("CALLER::temp_fpga", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type != defs::CHIPTESTBOARD &&
|
||||
det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, 0, GET, oss));
|
||||
@ -2058,7 +2060,6 @@ TEST_CASE("CALLER::dacvalues", "[.cmdcall]") {
|
||||
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, GET));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2066,7 +2067,8 @@ TEST_CASE("CALLER::defaultdac", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type != defs::CHIPTESTBOARD &&
|
||||
det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_THROWS(caller.call("defaultdac", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("defaultdac", {"blabla"}, -1, PUT));
|
||||
auto daclist = det.getDacList();
|
||||
@ -2125,7 +2127,8 @@ TEST_CASE("CALLER::resetdacs", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type != defs::CHIPTESTBOARD &&
|
||||
det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getSettings();
|
||||
|
||||
REQUIRE_THROWS(caller.call("resetdacs", {}, -1, GET));
|
||||
@ -2252,8 +2255,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
|
||||
if (det_type != defs::MYTHEN3) {
|
||||
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
|
||||
} else {
|
||||
auto t =
|
||||
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
||||
auto t = det.getExptimeForAllGates().tsquash(
|
||||
"inconsistent exptime to test");
|
||||
if (t[0] != t[1] || t[1] != t[2]) {
|
||||
throw RuntimeError("inconsistent exptime for all gates");
|
||||
}
|
||||
@ -2261,7 +2264,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
|
||||
}
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
|
||||
auto prev_period =
|
||||
det.getPeriod().tsquash("inconsistent period in test");
|
||||
det.setExptime(-1, std::chrono::microseconds(200));
|
||||
det.setPeriod(std::chrono::milliseconds(1));
|
||||
det.setNumberOfFrames(2000);
|
||||
@ -2296,8 +2300,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
|
||||
if (det_type != defs::MYTHEN3) {
|
||||
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
|
||||
} else {
|
||||
auto t =
|
||||
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
||||
auto t = det.getExptimeForAllGates().tsquash(
|
||||
"inconsistent exptime to test");
|
||||
if (t[0] != t[1] || t[1] != t[2]) {
|
||||
throw RuntimeError("inconsistent exptime for all gates");
|
||||
}
|
||||
@ -2305,7 +2309,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
|
||||
}
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
|
||||
auto prev_period =
|
||||
det.getPeriod().tsquash("inconsistent period in test");
|
||||
det.setExptime(-1, std::chrono::microseconds(200));
|
||||
det.setPeriod(std::chrono::milliseconds(1));
|
||||
det.setNumberOfFrames(2000);
|
||||
@ -2324,7 +2329,7 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
|
||||
std::ostringstream oss;
|
||||
caller.call("status", {}, -1, GET, oss);
|
||||
REQUIRE(((oss.str() == "status stopped\n") ||
|
||||
(oss.str() == "status idle\n")));
|
||||
(oss.str() == "status idle\n")));
|
||||
}
|
||||
det.setExptime(-1, prev_val);
|
||||
det.setPeriod(prev_period);
|
||||
@ -2343,8 +2348,8 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
|
||||
if (det_type != defs::MYTHEN3) {
|
||||
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
|
||||
} else {
|
||||
auto t =
|
||||
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
||||
auto t = det.getExptimeForAllGates().tsquash(
|
||||
"inconsistent exptime to test");
|
||||
if (t[0] != t[1] || t[1] != t[2]) {
|
||||
throw RuntimeError("inconsistent exptime for all gates");
|
||||
}
|
||||
@ -2352,7 +2357,8 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
|
||||
}
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
|
||||
auto prev_period =
|
||||
det.getPeriod().tsquash("inconsistent period in test");
|
||||
det.setExptime(-1, std::chrono::microseconds(200));
|
||||
det.setPeriod(std::chrono::milliseconds(1));
|
||||
det.setNumberOfFrames(2000);
|
||||
@ -2367,7 +2373,7 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
|
||||
std::ostringstream oss;
|
||||
caller.call("status", {}, -1, GET, oss);
|
||||
REQUIRE(((oss.str() == "status stopped\n") ||
|
||||
(oss.str() == "status idle\n")));
|
||||
(oss.str() == "status idle\n")));
|
||||
}
|
||||
det.setExptime(-1, prev_val);
|
||||
det.setPeriod(prev_period);
|
||||
@ -2492,31 +2498,31 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
|
||||
} else {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1, PUT,
|
||||
oss);
|
||||
CHECK(oss.str() ==
|
||||
"scan [" + ToString(ind) + ", 500, 1500, 500]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {}, -1, GET, oss);
|
||||
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
|
||||
"\nstart 500\nstop 1500\nstep "
|
||||
"500\nsettleTime 1ms\n]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"}, -1,
|
||||
caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1,
|
||||
PUT, oss);
|
||||
CHECK(oss.str() ==
|
||||
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
|
||||
"scan [" + ToString(ind) + ", 500, 1500, 500]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {}, -1, GET, oss);
|
||||
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
|
||||
"\nstart 500\nstop 1500\nstep "
|
||||
"500\nsettleTime 2s\n]\n");
|
||||
"\nstart 500\nstop 1500\nstep "
|
||||
"500\nsettleTime 1ms\n]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"},
|
||||
-1, PUT, oss);
|
||||
CHECK(oss.str() ==
|
||||
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {}, -1, GET, oss);
|
||||
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
|
||||
"\nstart 500\nstop 1500\nstep "
|
||||
"500\nsettleTime 2s\n]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -2530,18 +2536,18 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1, PUT,
|
||||
oss);
|
||||
caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1,
|
||||
PUT, oss);
|
||||
CHECK(oss.str() ==
|
||||
"scan [" + ToString(ind) + ", 1500, 500, -500]\n");
|
||||
"scan [" + ToString(ind) + ", 1500, 500, -500]\n");
|
||||
}
|
||||
CHECK_THROWS(caller.call(
|
||||
"scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1,
|
||||
PUT));
|
||||
CHECK_THROWS(caller.call("scan", {ToString(ind), "500", "1500", "-500"},
|
||||
-1, PUT));
|
||||
CHECK_THROWS(caller.call("scan", {ToString(ind), "1500", "500", "500"},
|
||||
-1, PUT));
|
||||
CHECK_THROWS(caller.call(
|
||||
"scan", {ToString(ind), "500", "1500", "-500"}, -1, PUT));
|
||||
CHECK_THROWS(caller.call(
|
||||
"scan", {ToString(ind), "1500", "500", "500"}, -1, PUT));
|
||||
|
||||
if (det_type == defs::MYTHEN3 || defs::EIGER) {
|
||||
{
|
||||
@ -2554,8 +2560,8 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
|
||||
std::ostringstream oss;
|
||||
caller.call("scan", {}, -1, GET, oss);
|
||||
CHECK(oss.str() ==
|
||||
"scan [enabled\ndac trimbits\nstart 0\nstop 48\nstep "
|
||||
"16\nsettleTime 2s\n]\n");
|
||||
"scan [enabled\ndac trimbits\nstart 0\nstop 48\nstep "
|
||||
"16\nsettleTime 2s\n]\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2567,12 +2573,13 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
|
||||
// Reset all dacs to previous value
|
||||
// for (int i = 0; i != det.size(); ++i) {
|
||||
// det.setDAC(ind, previous[i], false, {i});
|
||||
// det.setDAC(notImplementedInd, notImplementedPrevious[i], false,
|
||||
// {i});
|
||||
// det.setDAC(notImplementedInd, notImplementedPrevious[i],
|
||||
// false, {i});
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("scan", {ToString(defs::DAC_0), "500", "1500", "500"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call(
|
||||
"scan", {ToString(defs::DAC_0), "500", "1500", "500"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2684,7 +2691,6 @@ TEST_CASE("CALLER::udp_cleardst", "[.cmdcall]") {
|
||||
/*REQUIRE_NOTHROW(caller.call("udp_cleardst", {}, -1, PUT));*/
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("udp_cleardst", {}, -1, PUT));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2734,7 +2740,8 @@ TEST_CASE("CALLER::udp_srcmac", "[.cmdcall]") {
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getSourceUDPMAC();
|
||||
REQUIRE_THROWS(caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("udp_srcmac", {"00:50:c2:42:34:12"}, -1, PUT, oss);
|
||||
@ -2903,7 +2910,6 @@ TEST_CASE("CALLER::udp_validate", "[.cmdcall]") {
|
||||
REQUIRE_NOTHROW(caller.call("udp_validate", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("udp_validate", {}, -1, PUT));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user