mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
fix tests
This commit is contained in:
parent
993ba5926e
commit
00d63e48bb
@ -4705,7 +4705,6 @@ int get_read_n_rows(int file_des) {
|
||||
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getReadNRows();
|
||||
if (retval == -1) {
|
||||
ret = FAIL;
|
||||
@ -8685,7 +8684,7 @@ int get_flip_rows(int file_des) {
|
||||
// only for HW 2.0 (version = 3)
|
||||
if (isHardwareVersion2()) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not set flip rows. Only available for "
|
||||
strcpy(mess, "Could not get flip rows. Only available for "
|
||||
"Hardware Board version 2.0.\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
|
@ -1557,32 +1557,47 @@ TEST_CASE("readnrows", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getReadNRows();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {"256"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnrows 256\n");
|
||||
bool jungfrauhw2 = false;
|
||||
if (det_type == defs::JUNGFRAU &&
|
||||
!(det.getSerialNumber().tsquash(
|
||||
"inconsistent serial number to test") &
|
||||
0x20000)) {
|
||||
jungfrauhw2 = true;
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "readnrows 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {"16"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnrows 16\n");
|
||||
}
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"7"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"20"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"44"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"513"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setReadNRows(prev_val[i], {i});
|
||||
if (jungfrauhw2) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "readnrows 512\n");
|
||||
}
|
||||
} else {
|
||||
auto prev_val = det.getReadNRows();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {"256"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnrows 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "readnrows 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnrows", {"16"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnrows 16\n");
|
||||
}
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"7"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"20"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"44"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"513"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setReadNRows(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("readnrows", {}, -1, GET));
|
||||
|
Loading…
x
Reference in New Issue
Block a user