Skip to content
Snippets Groups Projects
Commit 934a3e04 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

IFFF: app->CS without version number and zmq complete

parent 91a10094
No related branches found
No related tags found
No related merge requests found
......@@ -134,6 +134,57 @@ BOOST_AUTO_TEST_CASE(testIfffUpdate) {
BOOST_CHECK_CLOSE(resultIfff.f1_data, referenceIfff.f1_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f2_data, referenceIfff.f2_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f3_data, referenceIfff.f3_data, 0.0001);
// change the values
IFFF newReferenceIfff;
newReferenceIfff.i1_data = 345;
newReferenceIfff.f1_data = 0.345f;
newReferenceIfff.f2_data = 3.454f;
newReferenceIfff.f3_data = -345;
// check data consistency implementation
// send only one variable, then change the version number again
referenceTestApplication.versionNumber = ChimeraTK::VersionNumber();
DoocsServerTestHelper::doocsSet<int>("//INT/TO_DEVICE_SCALAR", 543); // will never be seen
referenceTestApplication.runMainLoopOnce();
// sleep a bit, we don't except a change
sleep(1);
resultIfff = extractValue();
// compare with the old reference
BOOST_CHECK_EQUAL(resultIfff.i1_data, referenceIfff.i1_data);
BOOST_CHECK_CLOSE(resultIfff.f1_data, referenceIfff.f1_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f2_data, referenceIfff.f2_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f3_data, referenceIfff.f3_data, 0.0001);
referenceTestApplication.versionNumber = ChimeraTK::VersionNumber();
DoocsServerTestHelper::doocsSet<float>("//FLOAT/TO_DEVICE_SCALAR", newReferenceIfff.f1_data);
DoocsServerTestHelper::doocsSet<double>("//DOUBLE/TO_DEVICE_SCALAR", static_cast<double>(newReferenceIfff.f2_data));
DoocsServerTestHelper::doocsSet<int>("//SHORT/TO_DEVICE_SCALAR", static_cast<int>(newReferenceIfff.f3_data));
referenceTestApplication.runMainLoopOnce();
// all variables have been updated, but not in a consistent way. still no change
sleep(1);
resultIfff = extractValue();
// compare with the old reference
BOOST_CHECK_EQUAL(resultIfff.i1_data, referenceIfff.i1_data);
BOOST_CHECK_CLOSE(resultIfff.f1_data, referenceIfff.f1_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f2_data, referenceIfff.f2_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f3_data, referenceIfff.f3_data, 0.0001);
// finally upate the missing variable with the same version as the others
DoocsServerTestHelper::doocsSet<int>("//INT/TO_DEVICE_SCALAR", newReferenceIfff.i1_data);
referenceTestApplication.runMainLoopOnce();
// now we see the new reference
checkWithTimeout<int>(
[&]() -> int {
resultIfff = extractValue();
return resultIfff.i1_data;
},
newReferenceIfff.i1_data);
BOOST_CHECK_CLOSE(resultIfff.f1_data, newReferenceIfff.f1_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f2_data, newReferenceIfff.f2_data, 0.0001);
BOOST_CHECK_CLOSE(resultIfff.f3_data, newReferenceIfff.f3_data, 0.0001);
}
/**********************************************************************************************************************/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment