OutString for scanParameters

This commit is contained in:
Erik Frojdh 2020-07-06 09:19:44 +02:00
parent 28b3fb4101
commit 39bbc5c688
3 changed files with 30 additions and 1 deletions

View File

@ -1008,7 +1008,7 @@ std::string CmdProxy::Scan(int action) {
WrongNumberOfParameters(0);
}
auto t = det->getScan();
os << ToString(t) << '\n';
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
// disable
if (args.size() == 1) {

View File

@ -474,6 +474,13 @@ typedef struct {
stepSize(step) {
dacSettleTime_ns = t.count();
}
bool operator==(const scanParameters &other) const {
return ((enable == other.enable) && (dacInd == other.dacInd) &&
(startOffset == other.startOffset) &&
(stopOffset == other.stopOffset) &&
(stepSize == other.stepSize) &&
(dacSettleTime_ns == other.dacSettleTime_ns));
}
} __attribute__((packed));
#endif

View File

@ -49,4 +49,26 @@ TEST_CASE("assign module", "[support]") {
CHECK(m3.reg == 500);
CHECK(m3.iodelay == 750);
CHECK(m3.nchan == 256 * 256 * 4);
}
TEST_CASE("default construct scanParameters"){
slsDetectorDefs::scanParameters p;
CHECK(p.dacSettleTime_ns == 0);
CHECK(p.dacInd == slsDetectorDefs::DAC_0);
CHECK(p.enable == 0);
CHECK(p.startOffset == 0);
CHECK(p.stopOffset == 0);
CHECK(p.stepSize == 0);
}
TEST_CASE("compare two scanParameters"){
slsDetectorDefs::scanParameters p0;
slsDetectorDefs::scanParameters p1;
CHECK(p0 == p1);
p0.enable = 1;
CHECK_FALSE(p0 == p1);
}