1 #define BOOST_TEST_MODULE (LocalSignal_t) 2 #include "boost/test/tools/output_test_stream.hpp" 3 #include "boost/test/unit_test.hpp" 26 testCallback(std::ostream& os,
std::string const& text)
34 struct CallBackClass {
41 cfunc(std::ostream& os,
std::string const& text)
const 47 size_t const nSchedules{3};
51 BOOST_AUTO_TEST_SUITE(LocalSignal_t)
55 TestSignal2
s{nSchedules};
57 boost::test_tools::output_test_stream os;
58 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<1>));
59 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<2>));
60 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<3>));
62 "2: " + test_text +
"3: " + test_text};
63 BOOST_CHECK_NO_THROW(
s.invoke(sID, os, test_text));
64 BOOST_TEST(os.is_equal(cmp_text));
69 TestSignal2a
s{nSchedules};
71 boost::test_tools::output_test_stream os;
72 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<1>));
73 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<2>));
74 BOOST_CHECK_NO_THROW(
s.watch(sID, testCallback<3>));
76 "2: " + test_text +
"1: " + test_text};
77 BOOST_CHECK_NO_THROW(
s.invoke(sID, os, test_text));
78 BOOST_TEST(os.is_equal(cmp_text));
83 TestSignal2
s{nSchedules};
85 boost::test_tools::output_test_stream os;
88 BOOST_CHECK_NO_THROW(
s.invoke(sID, os, test_text));
89 BOOST_TEST(os.is_equal(test_text));
94 TestSignal2
s{nSchedules};
96 boost::test_tools::output_test_stream os;
97 CallBackClass
const cbc;
98 BOOST_CHECK_NO_THROW(
s.watch(sID, &CallBackClass::cfunc, cbc));
99 BOOST_CHECK_NO_THROW(
s.invoke(sID, os, test_text));
100 BOOST_TEST(os.is_equal(test_text));
105 TestSignal1
s{nSchedules};
107 boost::test_tools::output_test_stream os;
108 BOOST_CHECK_NO_THROW(
109 s.watch(sID, [&test_text](
auto&
x) { testCallback<0>(x, test_text); }));
110 BOOST_CHECK_NO_THROW(
s.invoke(sID, os));
111 BOOST_TEST(os.is_equal(test_text));
116 TestSignal0
s{nSchedules};
118 boost::test_tools::output_test_stream os;
119 BOOST_CHECK_NO_THROW(
120 s.watch(sID, [&os, &test_text] { testCallback<0>(os, test_text); }));
121 BOOST_CHECK_NO_THROW(
s.invoke(sID));
122 BOOST_TEST(os.is_equal(test_text));
127 TestSignal1
s{nSchedules};
129 boost::test_tools::output_test_stream os;
130 BOOST_CHECK_NO_THROW(
131 s.watchAll([&test_text](
auto&
x) { testCallback<0>(x, test_text); }));
132 BOOST_CHECK_NO_THROW(
s.invoke(sID, os));
133 BOOST_TEST(os.is_equal(test_text));
138 TestSignal2
s{nSchedules};
140 boost::test_tools::output_test_stream os;
141 BOOST_CHECK_NO_THROW(
s.watchAll(testCallback<0>));
142 BOOST_CHECK_NO_THROW(
s.invoke(sID, os, test_text));
143 BOOST_TEST(os.is_equal(test_text));
148 TestSignal0
s{nSchedules};
150 boost::test_tools::output_test_stream os;
151 BOOST_CHECK_NO_THROW(
152 s.watchAll([&os, &test_text] { testCallback<0>(os, test_text); }));
153 BOOST_CHECK_NO_THROW(
s.invoke(sID));
154 BOOST_TEST(os.is_equal(test_text));
159 TestSignal0
s{nSchedules};
161 boost::test_tools::output_test_stream os;
164 [&os, &test_text] { testCallback<0>(os, test_text); })),
168 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestSignal2_t)