1 #define BOOST_TEST_MODULE STGSubscriptions
3 #include "async_pool.h"
5 #pragma GCC diagnostic push
6 #pragma GCC diagnostic ignored "-Wold-style-cast"
7 #pragma GCC diagnostic ignored "-Wunused-parameter"
8 #pragma GCC diagnostic ignored "-Wsign-compare"
9 #pragma GCC diagnostic ignored "-Wparentheses"
10 #include <boost/test/unit_test.hpp>
11 #pragma GCC diagnostic pop
13 namespace AsyncPoolST = STG::AsyncPoolST;
22 BOOST_AUTO_TEST_SUITE()
24 BOOST_AUTO_TEST_CASE(BeforeStart)
26 BOOST_CHECK_EQUAL(counter, 0);
27 AsyncPoolST::enqueue([](){ ++counter; });
28 std::this_thread::sleep_for(std::chrono::milliseconds(500));
29 BOOST_CHECK_EQUAL(counter, 0);
32 BOOST_AUTO_TEST_CASE(AfterStart)
34 BOOST_CHECK_EQUAL(counter, 0);
36 std::this_thread::sleep_for(std::chrono::milliseconds(500));
37 BOOST_CHECK_EQUAL(counter, 1);
38 AsyncPoolST::enqueue([](){ ++counter; });
39 std::this_thread::sleep_for(std::chrono::milliseconds(500));
40 BOOST_CHECK_EQUAL(counter, 2);
43 BOOST_AUTO_TEST_CASE(AfterStop)
45 BOOST_CHECK_EQUAL(counter, 2);
47 std::this_thread::sleep_for(std::chrono::milliseconds(500));
48 BOOST_CHECK_EQUAL(counter, 2);
49 AsyncPoolST::enqueue([](){ ++counter; });
50 std::this_thread::sleep_for(std::chrono::milliseconds(500));
51 BOOST_CHECK_EQUAL(counter, 2);
54 BOOST_AUTO_TEST_SUITE_END()