mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-01 09:01:19 +01:00
clang-format
This commit is contained in:
14
slsDetectorSoftware/tests/test-CmdParser.cpp
Executable file → Normal file
14
slsDetectorSoftware/tests/test-CmdParser.cpp
Executable file → Normal file
@@ -3,7 +3,6 @@
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
|
||||
// tests to add
|
||||
// help for all docs
|
||||
// command for all depreciated commands
|
||||
@@ -135,9 +134,9 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
||||
REQUIRE(p.argv().size() == 1);
|
||||
}
|
||||
}
|
||||
WHEN("Parsing a string with -h at a different position"){
|
||||
WHEN("Parsing a string with -h at a different position") {
|
||||
std::string s = "list -h something";
|
||||
THEN("its also done right"){
|
||||
THEN("its also done right") {
|
||||
p.Parse(s);
|
||||
REQUIRE(p.isHelp());
|
||||
REQUIRE(p.command() == "list");
|
||||
@@ -145,9 +144,9 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
||||
REQUIRE(p.arguments().front() == "something");
|
||||
}
|
||||
}
|
||||
WHEN("Parsing a string with -help at a different position"){
|
||||
WHEN("Parsing a string with -help at a different position") {
|
||||
std::string s = "list --help something";
|
||||
THEN("its also done right"){
|
||||
THEN("its also done right") {
|
||||
p.Parse(s);
|
||||
REQUIRE(p.isHelp());
|
||||
REQUIRE(p.command() == "list");
|
||||
@@ -158,7 +157,7 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found det id"){
|
||||
TEST_CASE("Parsing consecutive strings resets not found det id") {
|
||||
CmdParser p;
|
||||
p.Parse("1:exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 1);
|
||||
@@ -166,10 +165,9 @@ TEST_CASE("Parsing consecutive strings resets not found det id"){
|
||||
REQUIRE(p.detector_id() == -1);
|
||||
p.Parse("3:exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 3);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found multi id"){
|
||||
TEST_CASE("Parsing consecutive strings resets not found multi id") {
|
||||
CmdParser p;
|
||||
p.Parse("1-1:exptime 0.5");
|
||||
REQUIRE(p.multi_id() == 1);
|
||||
|
||||
@@ -17,7 +17,8 @@ using test::PUT;
|
||||
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]") {
|
||||
TEST_CASE("Setting and reading back Chip test board dacs",
|
||||
"[.cmd][.dacs][.new]") {
|
||||
// dac 0 to dac 17
|
||||
|
||||
Detector det;
|
||||
@@ -25,12 +26,14 @@ TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]"
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
for (int i = 0; i < 18; ++i) {
|
||||
SECTION("dac " + std::to_string(i)) { test_dac(static_cast<defs::dacIndex>(i), "dac", 0); }
|
||||
SECTION("dac " + std::to_string(i)) {
|
||||
test_dac(static_cast<defs::dacIndex>(i), "dac", 0);
|
||||
}
|
||||
}
|
||||
// eiger
|
||||
//REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrs", {}, -1, GET));
|
||||
@@ -53,30 +56,30 @@ TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]"
|
||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
// gotthard
|
||||
//REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// mythen3
|
||||
//REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vpl", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
||||
@@ -94,6 +97,6 @@ TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]"
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
|
||||
/** temperature */
|
||||
/** temperature */
|
||||
|
||||
TEST_CASE("temp_fpgaext", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
@@ -25,7 +24,7 @@ TEST_CASE("temp_fpgaext", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgaext", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgaext", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_fpgaext "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgaext "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_fpgaext", {}, -1, GET));
|
||||
@@ -40,7 +39,7 @@ TEST_CASE("temp_10ge", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_10ge", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_10ge", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_10ge "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_10ge "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_10ge", {}, -1, GET));
|
||||
@@ -55,7 +54,7 @@ TEST_CASE("temp_dcdc", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_dcdc", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_dcdc", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_dcdc "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_dcdc "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_dcdc", {}, -1, GET));
|
||||
@@ -70,7 +69,7 @@ TEST_CASE("temp_sodl", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_sodl", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_sodl", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_sodl "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_sodl "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_sodl", {}, -1, GET));
|
||||
@@ -85,7 +84,7 @@ TEST_CASE("temp_sodr", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_sodr", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_sodr", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_sodr "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_sodr "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_sodr", {}, -1, GET));
|
||||
@@ -100,7 +99,7 @@ TEST_CASE("temp_fpgafl", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafl", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafl", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_fpgafl "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgafl "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_fpgafl", {}, -1, GET));
|
||||
@@ -115,7 +114,7 @@ TEST_CASE("temp_fpgafr", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafr", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafr", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_fpgafr "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgafr "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_fpgafr", {}, -1, GET));
|
||||
@@ -229,30 +228,6 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Eiger transmission delay", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -519,8 +494,6 @@ TEST_CASE("quad", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("trigger", "[.cmd]") {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
|
||||
@@ -9,7 +9,6 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
|
||||
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -20,10 +19,12 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
if (dacname == "dac") {
|
||||
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
||||
proxy.Call(dacname, {dacIndexstr, dacstr}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
REQUIRE(oss_set.str() ==
|
||||
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
proxy.Call(dacname, {dacIndexstr}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
}
|
||||
REQUIRE(oss_get.str() ==
|
||||
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
}
|
||||
// other detectors
|
||||
else {
|
||||
proxy.Call(dacname, {dacstr}, -1, PUT, oss_set);
|
||||
@@ -37,12 +38,15 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
}
|
||||
}
|
||||
|
||||
void test_onchip_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
void test_onchip_dac(defs::dacIndex index, const std::string &dacname,
|
||||
int dacvalue) {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call(dacname, {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
||||
REQUIRE_THROWS(proxy.Call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
||||
|
||||
int chipIndex = -1; // for now, it is -1 only
|
||||
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
||||
@@ -50,9 +54,11 @@ void test_onchip_dac(defs::dacIndex index, const std::string &dacname, int dacva
|
||||
auto chipIndexStr = std::to_string(chipIndex);
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
REQUIRE(oss_set.str() ==
|
||||
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
proxy.Call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
REQUIRE(oss_get.str() ==
|
||||
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
|
||||
// Reset all dacs to previous value
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
||||
void test_onchip_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname,
|
||||
int dacvalue);
|
||||
void test_onchip_dac(slsDetectorDefs::dacIndex index,
|
||||
const std::string &dacname, int dacvalue);
|
||||
|
||||
@@ -18,7 +18,8 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs][.new]") {
|
||||
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c
|
||||
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp,
|
||||
// ib_test_c
|
||||
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -90,6 +91,6 @@ TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,12 @@ TEST_CASE("bursts", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_burst = det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||
auto prev_trigger = det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||
auto prev_frames = det.getNumberOfTriggers().tsquash("#triggers should be same to test");
|
||||
auto prev_burst =
|
||||
det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||
auto prev_trigger =
|
||||
det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||
auto prev_frames = det.getNumberOfTriggers().tsquash(
|
||||
"#triggers should be same to test");
|
||||
auto prev_timingMode = det.getTimingMode();
|
||||
auto prev_burstMode = det.getBurstMode();
|
||||
// changing continuous mode frames and bursts
|
||||
@@ -47,7 +50,7 @@ TEST_CASE("bursts", "[.cmd][.new]") {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
}
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -100,15 +103,25 @@ TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vref_h_adc") { test_dac(defs::VREF_H_ADC, "vref_h_adc", 2099); }
|
||||
SECTION("vref_h_adc") {
|
||||
test_dac(defs::VREF_H_ADC, "vref_h_adc", 2099);
|
||||
}
|
||||
SECTION("vb_comp_fe") { test_dac(defs::VB_COMP_FE, "vb_comp_fe", 0); }
|
||||
SECTION("vb_comp_adc") { test_dac(defs::VB_COMP_ADC, "vb_comp_adc", 0); }
|
||||
SECTION("vb_comp_adc") {
|
||||
test_dac(defs::VB_COMP_ADC, "vb_comp_adc", 0);
|
||||
}
|
||||
SECTION("vcom_cds") { test_dac(defs::VCOM_CDS, "vcom_cds", 1400); }
|
||||
SECTION("vref_rstore") { test_dac(defs::VREF_RSTORE, "vref_rstore", 640); }
|
||||
SECTION("vref_rstore") {
|
||||
test_dac(defs::VREF_RSTORE, "vref_rstore", 640);
|
||||
}
|
||||
SECTION("vb_opa_1st") { test_dac(defs::VB_OPA_1ST, "vb_opa_1st", 0); }
|
||||
SECTION("vref_comp_fe") { test_dac(defs::VREF_COMP_FE, "vref_comp_fe", 0); }
|
||||
SECTION("vref_comp_fe") {
|
||||
test_dac(defs::VREF_COMP_FE, "vref_comp_fe", 0);
|
||||
}
|
||||
SECTION("vcom_adc1") { test_dac(defs::VCOM_ADC1, "vcom_adc1", 1400); }
|
||||
SECTION("vref_prech") { test_dac(defs::VREF_PRECH, "vref_prech", 1720); }
|
||||
SECTION("vref_prech") {
|
||||
test_dac(defs::VREF_PRECH, "vref_prech", 1720);
|
||||
}
|
||||
SECTION("vref_l_adc") { test_dac(defs::VREF_L_ADC, "vref_l_adc", 700); }
|
||||
SECTION("vref_cds") { test_dac(defs::VREF_CDS, "vref_cds", 1200); }
|
||||
SECTION("vb_cs") { test_dac(defs::VB_CS, "vb_cs", 2799); }
|
||||
@@ -178,7 +191,9 @@ TEST_CASE("vchip_comp_fe", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vchip_comp_fe") { test_onchip_dac(defs::VB_COMP_FE, "vchip_comp_fe", 0x137); }
|
||||
SECTION("vchip_comp_fe") {
|
||||
test_onchip_dac(defs::VB_COMP_FE, "vchip_comp_fe", 0x137);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_comp_fe", {}, -1, GET));
|
||||
}
|
||||
@@ -189,7 +204,9 @@ TEST_CASE("vchip_opa_1st", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vchip_opa_1st") { test_onchip_dac(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000); }
|
||||
SECTION("vchip_opa_1st") {
|
||||
test_onchip_dac(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_opa_1st", {}, -1, GET));
|
||||
}
|
||||
@@ -200,7 +217,9 @@ TEST_CASE("vchip_opa_fd", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vchip_opa_fd") { test_onchip_dac(defs::VB_OPA_FD, "vchip_opa_fd", 0x134); }
|
||||
SECTION("vchip_opa_fd") {
|
||||
test_onchip_dac(defs::VB_OPA_FD, "vchip_opa_fd", 0x134);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_opa_fd", {}, -1, GET));
|
||||
}
|
||||
@@ -211,7 +230,9 @@ TEST_CASE("vchip_comp_adc", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vchip_comp_adc") { test_onchip_dac(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF); }
|
||||
SECTION("vchip_comp_adc") {
|
||||
test_onchip_dac(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_comp_adc", {}, -1, GET));
|
||||
}
|
||||
@@ -222,7 +243,9 @@ TEST_CASE("vchip_ref_comp_fe", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
SECTION("vchip_ref_comp_fe") { test_onchip_dac(defs::VREF_COMP_FE, "vchip_ref_comp_fe", 0x100); }
|
||||
SECTION("vchip_ref_comp_fe") {
|
||||
test_onchip_dac(defs::VREF_COMP_FE, "vchip_ref_comp_fe", 0x100);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_ref_comp_fe", {}, -1, GET));
|
||||
}
|
||||
@@ -239,22 +262,6 @@ TEST_CASE("vchip_cs", "[.cmd][.onchipdacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("burstmode", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -286,7 +293,6 @@ TEST_CASE("burstmode", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vetoref", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -294,14 +300,14 @@ TEST_CASE("vetoref", "[.cmd]") {
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1, PUT)); // invalid chip index
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vetophoton", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -310,16 +316,17 @@ TEST_CASE("vetophoton", "[.cmd]") {
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1, PUT));// invalid chip index
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1, PUT)); // invalid photon number
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1, PUT)); // invald file
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
||||
PUT)); // invalid photon number
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||
PUT)); // invald file
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("inj_ch", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -327,8 +334,10 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto inj = det.getInjectChannel();
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"-1", "1"}, -1, PUT));// invalid offset
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"0", "0"}, -1, PUT));// invalid increment
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||
@@ -347,9 +356,6 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("burstperiod", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -372,7 +378,6 @@ TEST_CASE("burstperiod", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("currentsource", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -410,12 +415,12 @@ TEST_CASE("timingsource", "[.cmd]") {
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getTimingSource();
|
||||
/* { until its activated in fpga
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {"external"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "timingsource external\n");
|
||||
}*/
|
||||
{
|
||||
/* { until its activated in fpga
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {"external"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "timingsource external\n");
|
||||
}*/
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {"internal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "timingsource internal\n");
|
||||
|
||||
@@ -16,7 +16,8 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
||||
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds, vref_comp
|
||||
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
|
||||
// vref_comp
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@@ -24,7 +25,9 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
||||
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
|
||||
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
||||
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
|
||||
SECTION("vref_prech") { test_dac(defs::VREF_PRECH, "vref_prech", 1450); }
|
||||
SECTION("vref_prech") {
|
||||
test_dac(defs::VREF_PRECH, "vref_prech", 1450);
|
||||
}
|
||||
SECTION("vb_pixbuf") { test_dac(defs::VB_PIXBUF, "vb_pixbuf", 750); }
|
||||
SECTION("vb_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 480); }
|
||||
@@ -87,42 +90,10 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("nframes", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -171,7 +142,7 @@ TEST_CASE("timestamp", "[.cmd]") {
|
||||
}
|
||||
|
||||
TEST_CASE("adcreg", "[.cmd]") {
|
||||
//TODO! what is a safe value to use?
|
||||
// TODO! what is a safe value to use?
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@@ -234,5 +205,3 @@ TEST_CASE("resetfpga", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,13 +18,16 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
|
||||
// vbp_colbuf, vipre, vin_cm", vb_sda, vcasc_sfp, vout_cm, vipre_cds, ibias_sfp
|
||||
// vbp_colbuf, vipre, vin_cm", vb_sda, vcasc_sfp, vout_cm, vipre_cds,
|
||||
// ibias_sfp
|
||||
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH) {
|
||||
SECTION("vbp_colbuf") { test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300); }
|
||||
SECTION("vbp_colbuf") {
|
||||
test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300);
|
||||
}
|
||||
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
|
||||
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
|
||||
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
|
||||
@@ -65,16 +68,16 @@ TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// mythen3
|
||||
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
//REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
|
||||
@@ -89,22 +89,6 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("counters", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -126,7 +110,7 @@ TEST_CASE("counters", "[.cmd]") {
|
||||
proxy.Call("counters", {"0", "2", "1"}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "counters [0, 2, 1]\n");
|
||||
proxy.Call("counters", {"0", "2"}, -1, PUT, oss_set2);
|
||||
REQUIRE(oss_set2.str() == "counters [0, 2]\n");
|
||||
REQUIRE(oss_set2.str() == "counters [0, 2]\n");
|
||||
// put back old value
|
||||
proxy.Call("counters", list_str, -1, PUT, oss_set3);
|
||||
REQUIRE(oss_set3.str() == "counters " + sls::ToString(list_str) + "\n");
|
||||
|
||||
@@ -27,7 +27,7 @@ TEST_CASE("rx_version", "[.cmd][.rx][.new]") {
|
||||
std::ostringstream vs;
|
||||
vs << "rx_version 0x" << std::hex << APIRECEIVER << '\n';
|
||||
REQUIRE(oss.str() == vs.str());
|
||||
|
||||
|
||||
REQUIRE_THROWS(proxy.Call("rx_version", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,6 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") {
|
||||
// proxy.Call("rx_framescaught", {}, -1, GET, oss);
|
||||
// REQUIRE(oss.str() == "rx_framescaught 1\n");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("rx_missingpackets", "[.cmd][.rx][.new]") {
|
||||
@@ -141,15 +140,15 @@ TEST_CASE("rx_printconfig", "[.cmd][.rx][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("rx_printconfig", {}, -1, GET));
|
||||
}
|
||||
|
||||
|
||||
/* Receiver Config */
|
||||
/* Receiver Config */
|
||||
|
||||
TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
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;
|
||||
@@ -304,7 +303,8 @@ TEST_CASE("rx_padding", "[.cmd][.rx][.new]") {
|
||||
TEST_CASE("rx_udpsocksize", "[.cmd][.rx][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash("Need same udp socket buffer size to test");
|
||||
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
|
||||
"Need same udp socket buffer size to test");
|
||||
std::string s_new_val = std::to_string(prev_val - 1000);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -558,7 +558,7 @@ TEST_CASE("rx_framesperfile", "[.cmd][.rx][.new]") {
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setFramesPerFile(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
@@ -648,7 +648,7 @@ TEST_CASE("rx_zmqport", "[.cmd][.rx][.new]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRxZmqPort(prev_val_zmqport[i], i);
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
det.setNumberofUDPInterfaces(prev_val_numinterfaces[i], {i});
|
||||
det.setNumberofUDPInterfaces(prev_val_numinterfaces[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -683,7 +683,9 @@ TEST_CASE("rx_dbitlist", "[.cmd][.rx][.new]") {
|
||||
auto prev_val = det.getRxDbitList();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_dbitlist", {"0", "4", "5", "8", "9", "10", "52", "63"}, -1, PUT, oss);
|
||||
proxy.Call("rx_dbitlist",
|
||||
{"0", "4", "5", "8", "9", "10", "52", "63"}, -1, PUT,
|
||||
oss);
|
||||
REQUIRE(oss.str() == "rx_dbitlist [0, 4, 5, 8, 9, 10, 52, 63]\n");
|
||||
}
|
||||
{
|
||||
@@ -745,7 +747,8 @@ TEST_CASE("rx_jsonaddheader", "[.cmd][.rx][.new]") {
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"}, -1, PUT, oss);
|
||||
proxy.Call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"}, -1,
|
||||
PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||
}
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#include "Detector.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "tests/globals.h"
|
||||
|
||||
@@ -36,24 +36,25 @@ TEST_CASE("parameters", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
// put only
|
||||
REQUIRE_THROWS(proxy.Call("parameters", {}, -1, GET));
|
||||
/*
|
||||
auto prev_val = det.getNumberOfFrames().tsquash("Number of frames has to be same to test");
|
||||
{
|
||||
system("echo 'frames 2' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames().tsquash("failed") == 2);
|
||||
}
|
||||
{
|
||||
system("echo '0:frames 1' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames({0}).tsquash("failed") == 1);
|
||||
}
|
||||
det.setNumberOfFrames(prev_val);
|
||||
*/
|
||||
/*
|
||||
auto prev_val = det.getNumberOfFrames().tsquash("Number of frames has to
|
||||
be same to test");
|
||||
{
|
||||
system("echo 'frames 2' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames().tsquash("failed") == 2);
|
||||
}
|
||||
{
|
||||
system("echo '0:frames 1' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames({0}).tsquash("failed") == 1);
|
||||
}
|
||||
det.setNumberOfFrames(prev_val);
|
||||
*/
|
||||
}
|
||||
|
||||
TEST_CASE("hostname", "[.cmd][.new]") {
|
||||
@@ -106,7 +107,7 @@ TEST_CASE("detectornumber", "[.cmd][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("detectornumber", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("type", "[.cmd][.new]"){
|
||||
TEST_CASE("type", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto dt = det.getDetectorType().squash();
|
||||
@@ -130,46 +131,46 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
std::vector<std::string> sett;
|
||||
switch (det_type) {
|
||||
case defs::EIGER:
|
||||
//FIXME: need to remove when settings removed
|
||||
break;
|
||||
case defs::JUNGFRAU:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("dynamichg0");
|
||||
sett.push_back("fixgain1");
|
||||
sett.push_back("fixgain2");
|
||||
sett.push_back("forceswitchg1");
|
||||
sett.push_back("forceswitchg2");
|
||||
break;
|
||||
case defs::GOTTHARD:
|
||||
sett.push_back("highgain");
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("lowgain");
|
||||
sett.push_back("mediumgain");
|
||||
sett.push_back("veryhighgain");
|
||||
break;
|
||||
case defs::GOTTHARD2:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("fixgain1");
|
||||
sett.push_back("fixgain2");
|
||||
break;
|
||||
case defs::MOENCH:
|
||||
sett.push_back("g1_hg");
|
||||
sett.push_back("g1_lg");
|
||||
sett.push_back("g2_hc_hg");
|
||||
sett.push_back("g2_hc_lg");
|
||||
sett.push_back("g2_lc_hg");
|
||||
sett.push_back("g2_lc_lg");
|
||||
sett.push_back("g4_hg");
|
||||
sett.push_back("g4_lg");
|
||||
break;
|
||||
default:
|
||||
REQUIRE_THROWS(proxy.Call("settings", {}, -1, GET));
|
||||
return;
|
||||
case defs::EIGER:
|
||||
// FIXME: need to remove when settings removed
|
||||
break;
|
||||
case defs::JUNGFRAU:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("dynamichg0");
|
||||
sett.push_back("fixgain1");
|
||||
sett.push_back("fixgain2");
|
||||
sett.push_back("forceswitchg1");
|
||||
sett.push_back("forceswitchg2");
|
||||
break;
|
||||
case defs::GOTTHARD:
|
||||
sett.push_back("highgain");
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("lowgain");
|
||||
sett.push_back("mediumgain");
|
||||
sett.push_back("veryhighgain");
|
||||
break;
|
||||
case defs::GOTTHARD2:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("fixgain1");
|
||||
sett.push_back("fixgain2");
|
||||
break;
|
||||
case defs::MOENCH:
|
||||
sett.push_back("g1_hg");
|
||||
sett.push_back("g1_lg");
|
||||
sett.push_back("g2_hc_hg");
|
||||
sett.push_back("g2_hc_lg");
|
||||
sett.push_back("g2_lc_hg");
|
||||
sett.push_back("g2_lc_lg");
|
||||
sett.push_back("g4_hg");
|
||||
sett.push_back("g4_lg");
|
||||
break;
|
||||
default:
|
||||
REQUIRE_THROWS(proxy.Call("settings", {}, -1, GET));
|
||||
return;
|
||||
}
|
||||
|
||||
auto prev_val = det.getSettings();
|
||||
for (auto & it : sett) {
|
||||
for (auto &it : sett) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("settings", {it}, -1, PUT, oss);
|
||||
@@ -182,7 +183,7 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (prev_val[i] != defs::UNDEFINED &&
|
||||
if (prev_val[i] != defs::UNDEFINED &&
|
||||
prev_val[i] != defs::UNINITIALIZED) {
|
||||
det.setSettings(prev_val[i], {i});
|
||||
}
|
||||
@@ -196,7 +197,8 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
||||
TEST_CASE("frames", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getNumberOfFrames().tsquash("#frames must be same to test");
|
||||
auto prev_val =
|
||||
det.getNumberOfFrames().tsquash("#frames must be same to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("frames", {"1000"}, -1, PUT, oss);
|
||||
@@ -219,7 +221,8 @@ TEST_CASE("frames", "[.cmd][.new]") {
|
||||
TEST_CASE("triggers", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getNumberOfTriggers().tsquash("#triggers must be same to test");
|
||||
auto prev_val =
|
||||
det.getNumberOfTriggers().tsquash("#triggers must be same to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("triggers", {"1000"}, -1, PUT, oss);
|
||||
@@ -431,8 +434,8 @@ TEST_CASE("speed", "[.cmd][.new]") {
|
||||
REQUIRE(oss3.str() == "speed full_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "speed full_speed\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("speed", {"1"}, -1, PUT, oss1);
|
||||
@@ -468,10 +471,8 @@ TEST_CASE("adcphase", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD ||
|
||||
det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH) {
|
||||
if (det_type == defs::GOTTHARD || det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
std::ostringstream oss1;
|
||||
proxy.Call("adcphase", {"20"}, -1, PUT, oss1);
|
||||
@@ -480,14 +481,14 @@ TEST_CASE("adcphase", "[.cmd][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("adcphase", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("adcphase", {"20", "deg"}, -1, PUT));
|
||||
} else {
|
||||
auto prev_val = det.getADCPhase();
|
||||
auto prev_val = det.getADCPhase();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("adcphase", {"20"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "adcphase 20\n");
|
||||
proxy.Call("adcphase", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "adcphase 20\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("adcphase", {"20", "deg"}, -1, PUT, oss1);
|
||||
@@ -509,10 +510,9 @@ TEST_CASE("maxadcphaseshift", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
||||
REQUIRE_NOTHROW(proxy.Call("maxadcphaseshift", {}, -1, GET));
|
||||
} else {
|
||||
@@ -524,16 +524,15 @@ TEST_CASE("dbitphase", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getDBITPhase();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getDBITPhase();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("dbitphase", {"20"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dbitphase 20\n");
|
||||
proxy.Call("dbitphase", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dbitphase 20\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("dbitphase", {"20", "deg"}, -1, PUT, oss1);
|
||||
@@ -554,9 +553,8 @@ TEST_CASE("maxdbitphaseshift", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
||||
REQUIRE_NOTHROW(proxy.Call("maxdbitphaseshift", {}, -1, GET));
|
||||
} else {
|
||||
@@ -654,7 +652,6 @@ TEST_CASE("maxclkphaseshift", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -677,11 +674,10 @@ TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "vhighvoltage 0\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// range 0, 60 - 200
|
||||
else if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH) {
|
||||
else if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH) {
|
||||
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
@@ -697,7 +693,7 @@ TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
proxy.Call("vhighvoltage", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "vhighvoltage 0\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// full range 0 - 200 (get needs to wait)
|
||||
else if (det_type == defs::EIGER) {
|
||||
{
|
||||
@@ -724,7 +720,7 @@ TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
proxy.Call("vhighvoltage", {}, 0, GET, oss2);
|
||||
REQUIRE(oss2.str() == "vhighvoltage 0\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// full range 0 - 200
|
||||
else {
|
||||
{
|
||||
@@ -761,10 +757,8 @@ TEST_CASE("powerchip", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2 ||
|
||||
det_type == defs::MOENCH) {
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2 || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getPowerChip();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@@ -812,8 +806,7 @@ TEST_CASE("imagetest", "[.cmd][.new]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setImageTestMode(prev_val[i], {i});
|
||||
}
|
||||
} else if (det_type != defs::JUNGFRAU &&
|
||||
det_type != defs::EIGER) {
|
||||
} else if (det_type != defs::JUNGFRAU && det_type != defs::EIGER) {
|
||||
// wont fail for eiger and jungfrau virtual servers
|
||||
REQUIRE_THROWS(proxy.Call("imagetest", {}, -1, GET));
|
||||
}
|
||||
@@ -829,7 +822,7 @@ TEST_CASE("temp_adc", "[.cmd][.new]") {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_adc", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_adc", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_adc "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_adc "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_adc", {}, -1, GET));
|
||||
@@ -841,11 +834,11 @@ TEST_CASE("temp_fpga", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::GOTTHARD ||
|
||||
det_type == defs::EIGER) {
|
||||
det_type == defs::EIGER) {
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpga", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(proxy.Call("temp_fpga", {}, 0, GET, oss));
|
||||
std::string s = (oss.str()).erase (0, strlen("temp_fpga "));
|
||||
std::string s = (oss.str()).erase(0, strlen("temp_fpga "));
|
||||
REQUIRE(std::stoi(s) != -1);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("temp_fpga", {}, -1, GET));
|
||||
@@ -932,7 +925,7 @@ TEST_CASE("status", "[.cmd][.new]") {
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExptime(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("startingfnum", "[.cmd][.new]") {
|
||||
@@ -959,50 +952,12 @@ TEST_CASE("startingfnum", "[.cmd][.new]") {
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStartingFrameNumber(prev_sfnum[i], {i});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("startingfnum", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("initialchecks", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -1021,18 +976,17 @@ TEST_CASE("initialchecks", "[.cmd]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("initialchecks", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "initialchecks 0\n");
|
||||
REQUIRE(oss.str() == "initialchecks 0\n");
|
||||
}
|
||||
{
|
||||
det.setHostname(hostname);
|
||||
std::ostringstream oss;
|
||||
proxy.Call("initialchecks", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "initialchecks 0\n");
|
||||
}
|
||||
REQUIRE(oss.str() == "initialchecks 0\n");
|
||||
}
|
||||
det.setInitialChecks(check);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -1313,7 +1267,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT));
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("patsetbit", "[.cmd][.ctb]") {
|
||||
// if (test::type == defs::CHIPTESTBOARD) {
|
||||
// uint64_t val = 0;
|
||||
@@ -1932,8 +1885,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("romode", "[.cmd][.ctb]") {
|
||||
// if (test::type == defs::CHIPTESTBOARD) {
|
||||
// {
|
||||
@@ -2415,8 +2366,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("trimval", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@@ -2460,8 +2409,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("parallel", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@@ -2556,7 +2503,9 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("zmqport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "zmqport " + std::to_string(port + i * socketsperdetector) + '\n');
|
||||
REQUIRE(oss.str() == "zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) +
|
||||
'\n');
|
||||
}
|
||||
|
||||
port = 1954;
|
||||
@@ -2569,18 +2518,15 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("zmqport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "zmqport " + std::to_string(port + i * socketsperdetector) + '\n');
|
||||
REQUIRE(oss.str() == "zmqport " +
|
||||
std::to_string(port + i * socketsperdetector) +
|
||||
'\n');
|
||||
}
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
det.setNumberofUDPInterfaces(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@@ -2823,8 +2769,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("adc", "[.cmd][.ctb]") {
|
||||
// if (test::type != defs::CHIPTESTBOARD) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
|
||||
@@ -2838,9 +2782,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("syncclk", "[.cmd][.ctb]") {
|
||||
// if(test::type != defs::CHIPTESTBOARD) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk", GET));
|
||||
@@ -2934,8 +2875,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("threshold", "[.cmd]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("threshold 6400 standard",
|
||||
@@ -2964,7 +2903,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// CHECK_NOTHROW(multiSlsDetectorClient("type", GET));
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("status", "[.cmd]") {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
@@ -2999,11 +2937,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// proxy.Call("frames", {"1"}, -1, PUT);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("lock", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@@ -3027,8 +2960,3 @@ TEST_CASE("lock", "[.cmd]") {
|
||||
// TEST_CASE("lastclient", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include "TypeTraits.h"
|
||||
#include "catch.hpp"
|
||||
#include <string>
|
||||
#include "ToString.h"
|
||||
|
||||
using sls::Result;
|
||||
|
||||
@@ -35,13 +35,12 @@ TEST_CASE("Like vector it can be constructed from size and value") {
|
||||
REQUIRE(res[4] == 7);
|
||||
}
|
||||
|
||||
TEST_CASE("Result can be iterated using modern syntax"){
|
||||
Result<int> res{0,1,2,3,4,5};
|
||||
TEST_CASE("Result can be iterated using modern syntax") {
|
||||
Result<int> res{0, 1, 2, 3, 4, 5};
|
||||
|
||||
int i = 0;
|
||||
for (const auto& r:res)
|
||||
for (const auto &r : res)
|
||||
REQUIRE(r == i++);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Calling squash on an empty Result produces default value") {
|
||||
@@ -136,21 +135,20 @@ TEST_CASE("Convert from Result<int> to Result<ns>") {
|
||||
REQUIRE(res2[2] == ns(236));
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Result of vectors"){
|
||||
TEST_CASE("Result of vectors") {
|
||||
using VecVec = std::vector<std::vector<int>>;
|
||||
VecVec vecvec{{1,2,3}, {4,5,6}};
|
||||
VecVec vecvec{{1, 2, 3}, {4, 5, 6}};
|
||||
Result<VecVec> res{vecvec};
|
||||
}
|
||||
|
||||
TEST_CASE("Free function begin end"){
|
||||
TEST_CASE("Free function begin end") {
|
||||
Result<std::string> res{"ett", "nio", "sjutton"};
|
||||
REQUIRE(begin(res) == res.begin());
|
||||
REQUIRE(end(res) == res.end());
|
||||
}
|
||||
|
||||
TEST_CASE("Sorting a Result"){
|
||||
Result<int> res{4,5,1,3};
|
||||
TEST_CASE("Sorting a Result") {
|
||||
Result<int> res{4, 5, 1, 3};
|
||||
std::sort(res.begin(), res.end());
|
||||
REQUIRE(res[0] == 1);
|
||||
REQUIRE(res[1] == 3);
|
||||
@@ -158,24 +156,22 @@ TEST_CASE("Sorting a Result"){
|
||||
REQUIRE(res[3] == 5);
|
||||
}
|
||||
|
||||
TEST_CASE("Printing Result<std::string>"){
|
||||
TEST_CASE("Printing Result<std::string>") {
|
||||
Result<std::string> res{"ein", "zwei", "drei"};
|
||||
std::ostringstream os;
|
||||
os << res;
|
||||
REQUIRE(os.str() == "[ein, zwei, drei]");
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Printing Result<int>"){
|
||||
TEST_CASE("Printing Result<int>") {
|
||||
Result<int> res{1, 2, 3};
|
||||
std::ostringstream os;
|
||||
os << res;
|
||||
REQUIRE(os.str() == "[1, 2, 3]");
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("String conversions"){
|
||||
Result<int> res{1,2,3};
|
||||
TEST_CASE("String conversions") {
|
||||
Result<int> res{1, 2, 3};
|
||||
REQUIRE(ToString(res) == "[1, 2, 3]");
|
||||
|
||||
Result<std::string> res2{"one", "two", "three"};
|
||||
@@ -185,7 +181,7 @@ TEST_CASE("String conversions"){
|
||||
Smap m;
|
||||
m["one"] = "1";
|
||||
Result<Smap> res3{m, m, m};
|
||||
REQUIRE(res3.size()== 3);
|
||||
REQUIRE(res3.size() == 3);
|
||||
REQUIRE(ToString(res3) == "[{one: 1}, {one: 1}, {one: 1}]");
|
||||
|
||||
Smap m2;
|
||||
@@ -194,5 +190,6 @@ TEST_CASE("String conversions"){
|
||||
m2["three"] = "3";
|
||||
|
||||
Result<Smap> res4{m, m2, m};
|
||||
REQUIRE(ToString(res4) == "[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
|
||||
REQUIRE(ToString(res4) ==
|
||||
"[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
|
||||
}
|
||||
|
||||
23
slsDetectorSoftware/tests/test-SharedMemory.cpp
Executable file → Normal file
23
slsDetectorSoftware/tests/test-SharedMemory.cpp
Executable file → Normal file
@@ -64,24 +64,24 @@ TEST_CASE("Creating a second shared memory with the same name throws",
|
||||
|
||||
TEST_CASE("Open two shared memories to the same place", "[detector]") {
|
||||
|
||||
//Create the first shared memory
|
||||
// Create the first shared memory
|
||||
SharedMemory<Data> shm(shm_id, -1);
|
||||
shm.CreateSharedMemory();
|
||||
shm()->x = 5;
|
||||
CHECK(shm()->x == 5);
|
||||
|
||||
//Open the second shared memory with the same name
|
||||
// Open the second shared memory with the same name
|
||||
SharedMemory<Data> shm2(shm_id, -1);
|
||||
shm2.OpenSharedMemory();
|
||||
CHECK(shm2()->x == 5);
|
||||
CHECK(shm.GetName() == shm2.GetName());
|
||||
|
||||
//Check that they still point to the same place
|
||||
// Check that they still point to the same place
|
||||
shm2()->x = 7;
|
||||
CHECK(shm()->x == 7);
|
||||
|
||||
//Remove only needs to be done once since they refer
|
||||
//to the same memory
|
||||
// Remove only needs to be done once since they refer
|
||||
// to the same memory
|
||||
shm2.RemoveSharedMemory();
|
||||
CHECK(shm.IsExisting() == false);
|
||||
CHECK(shm2.IsExisting() == false);
|
||||
@@ -95,19 +95,18 @@ TEST_CASE("Move SharedMemory", "[detector]") {
|
||||
shm.CreateSharedMemory();
|
||||
shm()->x = 9;
|
||||
|
||||
CHECK(shm.size()== sizeof(Data));
|
||||
CHECK(shm.size() == sizeof(Data));
|
||||
|
||||
SharedMemory<Data> shm2(shm_id+1, -1);
|
||||
shm2 = std::move(shm); //shm is now a moved from object!
|
||||
SharedMemory<Data> shm2(shm_id + 1, -1);
|
||||
shm2 = std::move(shm); // shm is now a moved from object!
|
||||
|
||||
CHECK(shm2()->x == 9);
|
||||
CHECK(shm() == nullptr);
|
||||
CHECK(shm.size() == 0);
|
||||
|
||||
CHECK(shm2.GetName() == std::string("/slsDetectorPackage_multi_") +
|
||||
std::to_string(shm_id));
|
||||
CHECK(shm2.GetName() ==
|
||||
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||
shm2.RemoveSharedMemory();
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Create several shared memories", "[detector]") {
|
||||
@@ -115,7 +114,7 @@ TEST_CASE("Create several shared memories", "[detector]") {
|
||||
std::vector<SharedMemory<int>> v;
|
||||
v.reserve(N);
|
||||
for (int i = 0; i != N; ++i) {
|
||||
v.emplace_back(shm_id+i, -1);
|
||||
v.emplace_back(shm_id + i, -1);
|
||||
CHECK(v[i].IsExisting() == false);
|
||||
v[i].CreateSharedMemory();
|
||||
*v[i]() = i;
|
||||
|
||||
19
slsDetectorSoftware/tests/test-slsDetector.cpp
Executable file → Normal file
19
slsDetectorSoftware/tests/test-slsDetector.cpp
Executable file → Normal file
@@ -7,8 +7,6 @@
|
||||
// #include <algorithm>
|
||||
// #include <iostream>
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("Set and get trimen", "[detector]") {
|
||||
// // Free shared memory to be sure that we start in a clean state
|
||||
// slsDetector::freeSharedMemory(20, 20);
|
||||
@@ -188,11 +186,9 @@
|
||||
// d.setPartialFramesPadding(true);
|
||||
// CHECK(d.getPartialFramesPadding() == true);
|
||||
|
||||
|
||||
// d.freeSharedMemory();
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// TEST_CASE("create detParamets struct", "[detector][new]"){
|
||||
// detParameters par;
|
||||
@@ -206,7 +202,6 @@
|
||||
// CHECK(par.nGappixelsX == 0);
|
||||
// CHECK(par.nGappixelsY == 0);
|
||||
|
||||
|
||||
// detParameters par2{slsDetectorDefs::detectorType::EIGER};
|
||||
// CHECK(sizeof(par2) == 32);
|
||||
// CHECK(par2.nChanX == 256);
|
||||
@@ -219,7 +214,6 @@
|
||||
// CHECK(par2.nGappixelsY == 1);
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("ctb digital offset and list", "[detector][ctb]"){
|
||||
// slsDetector::freeSharedMemory(20, 20);
|
||||
// slsDetector d(slsDetectorDefs::detectorType::CHIPTESTBOARD, 20, 20);
|
||||
@@ -235,29 +229,26 @@
|
||||
// std::vector <int> list = d.getReceiverDbitList();
|
||||
// CHECK(list.empty());
|
||||
|
||||
|
||||
// for (int i = 0; i < 10; ++i)
|
||||
// list.push_back(i);
|
||||
// d.setReceiverDbitList(list);
|
||||
|
||||
|
||||
// CHECK(d.getReceiverDbitList().size() == 10);
|
||||
|
||||
// list.push_back(64);
|
||||
// CHECK_THROWS_AS(d.setReceiverDbitList(list), sls::RuntimeError);
|
||||
// CHECK_THROWS_WITH(d.setReceiverDbitList(list),
|
||||
// CHECK_THROWS_WITH(d.setReceiverDbitList(list),
|
||||
// Catch::Matchers::Contains("be between 0 and 63"));
|
||||
|
||||
// list.clear();
|
||||
// for (int i = 0; i < 65; ++i)
|
||||
// list.push_back(i);
|
||||
// CHECK(list.size() == 65);
|
||||
// CHECK_THROWS_WITH(d.setReceiverDbitList(list),
|
||||
// CHECK_THROWS_WITH(d.setReceiverDbitList(list),
|
||||
// Catch::Matchers::Contains("be greater than 64"));
|
||||
|
||||
// list.clear();
|
||||
// list.clear();
|
||||
// d.setReceiverDbitList(list);
|
||||
// CHECK(d.getReceiverDbitList().empty());
|
||||
|
||||
|
||||
|
||||
// }
|
||||
Reference in New Issue
Block a user