ran tests and fixed

This commit is contained in:
2020-10-08 15:44:15 +02:00
parent b9a459faa1
commit a838830090
8 changed files with 153 additions and 210 deletions

View File

@ -106,121 +106,3 @@ TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
}
}
/* Moench */
TEST_CASE("emin", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
{
std::ostringstream oss;
proxy.Call("emin", {"100"}, -1, PUT, oss);
REQUIRE(oss.str() == "emin 100\n");
}
{
std::ostringstream oss;
proxy.Call("emin", {"200"}, -1, PUT, oss);
REQUIRE(oss.str() == "emin 200\n");
}
{
std::ostringstream oss;
proxy.Call("emin", {}, -1, GET, oss);
REQUIRE(oss.str() == "emin 200\n");
}
} else {
REQUIRE_THROWS(proxy.Call("emin", {}, -1, GET));
}
}
TEST_CASE("emax", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
{
std::ostringstream oss;
proxy.Call("emax", {"100"}, -1, PUT, oss);
REQUIRE(oss.str() == "emax 100\n");
}
{
std::ostringstream oss;
proxy.Call("emax", {"200"}, -1, PUT, oss);
REQUIRE(oss.str() == "emax 200\n");
}
{
std::ostringstream oss;
proxy.Call("emax", {}, -1, GET, oss);
REQUIRE(oss.str() == "emax 200\n");
}
} else {
REQUIRE_THROWS(proxy.Call("emax", {}, -1, GET));
}
}
TEST_CASE("framemode", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
{
std::ostringstream oss;
proxy.Call("framemode", {"pedestal"}, -1, PUT, oss);
REQUIRE(oss.str() == "framemode pedestal\n");
}
{
std::ostringstream oss;
proxy.Call("framemode", {"newpedestal"}, -1, PUT, oss);
REQUIRE(oss.str() == "framemode newpedestal\n");
}
{
std::ostringstream oss;
proxy.Call("framemode", {"flatfield"}, -1, PUT, oss);
REQUIRE(oss.str() == "framemode flatfield\n");
}
{
std::ostringstream oss;
proxy.Call("framemode", {"newflatfield"}, -1, PUT, oss);
REQUIRE(oss.str() == "framemode newflatfield\n");
}
{
std::ostringstream oss;
proxy.Call("framemode", {}, -1, GET, oss);
REQUIRE(oss.str() == "framemode newflatfield\n");
}
REQUIRE_THROWS(proxy.Call("framemode", {"counting"}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("framemode", {}, -1, GET));
}
}
TEST_CASE("detectormode", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
{
std::ostringstream oss;
proxy.Call("detectormode", {"counting"}, -1, PUT, oss);
REQUIRE(oss.str() == "detectormode counting\n");
}
{
std::ostringstream oss;
proxy.Call("detectormode", {"interpolating"}, -1, PUT, oss);
REQUIRE(oss.str() == "detectormode interpolating\n");
}
{
std::ostringstream oss;
proxy.Call("detectormode", {"analog"}, -1, PUT, oss);
REQUIRE(oss.str() == "detectormode analog\n");
}
std::ostringstream oss;
proxy.Call("detectormode", {}, -1, GET, oss);
REQUIRE(oss.str() == "detectormode analog\n");
REQUIRE_THROWS(proxy.Call("detectormode", {"pedestal"}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("detectormode", {}, -1, GET));
}
}