This commit is contained in:
2020-07-03 17:14:45 +02:00
parent 95089b5faa
commit 05059c1176
3 changed files with 154 additions and 1 deletions

View File

@ -106,7 +106,7 @@ std::string ToString(const slsDetectorDefs::scanParameters &r) {
std::ostringstream oss;
oss << '[';
if (r.enable) {
oss << "enabled " << std::endl
oss << "enabled" << std::endl
<< "dac " << ToString(r.dacInd) << std::endl
<< "start " << r.startOffset << std::endl
<< "stop " << r.stopOffset << std::endl

View File

@ -273,4 +273,29 @@ TEST_CASE("int or uin64_t to a string in hex") {
REQUIRE(r == "[0xf4, 0xffff, 0x1900b6]");
r = ToStringHex(temp, 8);
REQUIRE(r == "[0x000000f4, 0x0000ffff, 0x001900b6]");
}
TEST_CASE("Streaming of slsDetectorDefs::scanParameters") {
using namespace sls;
{
defs::scanParameters t{};
std::ostringstream oss;
oss << t;
REQUIRE(oss.str() == "[disabled]");
}
{
defs::scanParameters t{defs::VTH2, 500, 1500, 500};
std::ostringstream oss;
oss << t;
REQUIRE(oss.str() == "[enabled\ndac vth2\nstart 500\nstop 1500\nstep "
"500\nsettleTime 1ms\n]");
}
{
defs::scanParameters t{defs::VTH2, 500, 1500, 500,
std::chrono::milliseconds{500}};
std::ostringstream oss;
oss << t;
REQUIRE(oss.str() == "[enabled\ndac vth2\nstart 500\nstop 1500\nstep "
"500\nsettleTime 0.5s\n]");
}
}