gotthard2: timingsource and currentsource features, (timing source external yet to be implemented in fpga to test (#80)

This commit is contained in:
Dhanya Thattil
2020-02-28 12:45:02 +01:00
committed by GitHub
parent 2e2e91b219
commit 11e7737a2f
17 changed files with 334 additions and 3 deletions

View File

@ -282,3 +282,62 @@ TEST_CASE("burstperiod", "[.cmd]") {
}
TEST_CASE("currentsource", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_val = det.getCurrentSource();
{
std::ostringstream oss;
proxy.Call("currentsource", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "currentsource 1\n");
}
{
std::ostringstream oss;
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "currentsource 0\n");
}
{
std::ostringstream oss;
proxy.Call("currentsource", {}, -1, GET, oss);
REQUIRE(oss.str() == "currentsource 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setCurrentSource(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("currentsource", {}, -1, GET));
}
}
TEST_CASE("timingsource", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
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");
}*/
{
std::ostringstream oss;
proxy.Call("timingsource", {"internal"}, -1, PUT, oss);
REQUIRE(oss.str() == "timingsource internal\n");
}
{
std::ostringstream oss;
proxy.Call("timingsource", {}, -1, GET, oss);
REQUIRE(oss.str() == "timingsource internal\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTimingSource(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("timingsource", {}, -1, GET));
}
}