1 #define BOOST_TEST_MODULE (GlobalSignal_t) 2 #include "boost/test/tools/output_test_stream.hpp" 3 #include "boost/test/unit_test.hpp" 25 testCallback(std::ostream& os,
std::string const& text)
32 struct CallBackClass {
39 cfunc(std::ostream& os,
std::string const& text)
const 46 BOOST_AUTO_TEST_SUITE(GlobalSignal_t)
52 boost::test_tools::output_test_stream os;
53 s.watch(testCallback<1>);
54 s.watch(testCallback<2>);
55 s.watch(testCallback<3>);
57 "2: " + test_text +
"3: " + test_text};
58 BOOST_CHECK_NO_THROW(
s.invoke(os, test_text));
59 BOOST_TEST(os.is_equal(cmp_text));
66 boost::test_tools::output_test_stream os;
67 s.watch(testCallback<1>);
68 s.watch(testCallback<2>);
69 s.watch(testCallback<3>);
71 "2: " + test_text +
"1: " + test_text};
72 BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
73 BOOST_TEST(os.is_equal(cmp_text));
80 boost::test_tools::output_test_stream os;
83 BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
84 BOOST_TEST(os.is_equal(test_text));
91 boost::test_tools::output_test_stream os;
92 CallBackClass
const cbc;
93 s.watch(&CallBackClass::cfunc, cbc);
94 BOOST_CHECK_NO_THROW(s.invoke(os, test_text));
95 BOOST_TEST(os.is_equal(test_text));
102 boost::test_tools::output_test_stream os;
103 s.watch([&test_text](
auto&
x) { testCallback<0>(
x, test_text); });
104 BOOST_CHECK_NO_THROW(s.invoke(os));
105 BOOST_TEST(os.is_equal(test_text));
112 boost::test_tools::output_test_stream os;
118 std::ostringstream& osr [[maybe_unused]]{os};
119 s.watch([&osr, &test_text] { testCallback<0>(osr, test_text); });
120 BOOST_CHECK_NO_THROW(s.invoke());
121 BOOST_TEST(os.is_equal(test_text));
124 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestSignal2_t)