diff --git a/tests/executables_src/testFanoutConnections.cc b/tests/executables_src/testFanoutConnections.cc index 70f5e10f355bb8d23ffccfe960acd826e4938d1b..ffac2352a72ca256c7ec063f78bc1015a8a89554 100644 --- a/tests/executables_src/testFanoutConnections.cc +++ b/tests/executables_src/testFanoutConnections.cc @@ -36,67 +36,57 @@ struct TestModule1 : ctk::ApplicationModule { } }; +// FIXME: This test is probably already covered by one of the other test cases +// What it previously tested, a different connection order of device and application to CS, is +// no longer possible. +// // the connection code has to create a consuming fan out because m1.i3 is a poll type consumer, // and a trigger fan out because m1.i1 only has one push type consumer in the CS struct TestApplication1 : ctk::Application { - TestApplication1(bool connectDeviceFirst) : Application("testApp"), _connectDeviceFirst(connectDeviceFirst) {} - ~TestApplication1() { shutdown(); } + TestApplication1() : Application("testApp") {} + ~TestApplication1() override { shutdown(); } - /*void defineConnections() { - if(_connectDeviceFirst) { - device.connectTo(cs, cs("deviceTrigger", typeid(int), 1)); - findTag(".*").connectTo(cs); - } - else { - findTag(".*").connectTo(cs); - device.connectTo(cs, cs("deviceTrigger", typeid(int), 1)); - } - }*/ constexpr static char const* dummyCDD1 = "(dummy?map=testDataValidity1.map)"; TestModule1 m1{this, "m1", ""}; - ctk::DeviceModule device{this, dummyCDD1}; - - bool _connectDeviceFirst; + ctk::DeviceModule device{this, dummyCDD1, "/deviceTrigger"}; }; BOOST_AUTO_TEST_CASE(testConnectConsumingFanout) { - for(int deviceFirst = 0; deviceFirst < 2; ++deviceFirst) { - TestApplication1 theApp(deviceFirst); - ctk::TestFacility testFacility{theApp}; - ChimeraTK::Device dummy(TestApplication1::dummyCDD1); + TestApplication1 theApp; + ctk::TestFacility testFacility{theApp}; + ChimeraTK::Device dummy(TestApplication1::dummyCDD1); - // write iniial values to the dummy before starting the application - dummy.open(); - dummy.write("m1/i1/DUMMY_WRITEABLE", 12); - dummy.write("m1/i3/DUMMY_WRITEABLE", 32); + // write initial values to the dummy before starting the application + dummy.open(); + dummy.write("m1/i1/DUMMY_WRITEABLE", 12); + dummy.write("m1/i3/DUMMY_WRITEABLE", 32); - testFacility.runApplication(); + testFacility.runApplication(); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 12); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 32); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 12); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 32); - // check that the trigger only affects i1 - dummy.write("m1/i1/DUMMY_WRITEABLE", 13); - dummy.write("m1/i3/DUMMY_WRITEABLE", 33); + // check that the trigger only affects i1 + dummy.write("m1/i1/DUMMY_WRITEABLE", 13); + dummy.write("m1/i3/DUMMY_WRITEABLE", 33); - testFacility.writeScalar<int>("deviceTrigger", 1); - testFacility.stepApplication(); + testFacility.getVoid("deviceTrigger").write(); + testFacility.stepApplication(); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 13); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 32); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 13); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 32); - // check that the module trigger updates i3 - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/moduleOutput"), 0); + // check that the module trigger updates i3 + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/moduleOutput"), 0); - dummy.write("m1/i1/DUMMY_WRITEABLE", 14); - dummy.write("m1/i3/DUMMY_WRITEABLE", 34); + dummy.write("m1/i1/DUMMY_WRITEABLE", 14); + dummy.write("m1/i3/DUMMY_WRITEABLE", 34); - testFacility.writeScalar<int>("m1/moduleTrigger", 1); - testFacility.stepApplication(); + testFacility.writeScalar<int>("m1/moduleTrigger", 1); + testFacility.stepApplication(); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 13); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 34); - BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/moduleOutput"), 34); - } + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i1"), 13); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/i3"), 34); + BOOST_CHECK_EQUAL(testFacility.readScalar<int>("m1/moduleOutput"), 34); }