23#include <boost/test/unit_test.hpp>
32struct TestHandler :
RefCount<TestHandler, ThreadUnsafePolicy> {
50 using namespace literals::chrono_literals;
58 const auto now = CyclTime::now();
62 socks.first.send(
"foo", 4, 0);
63 socks.first.send(
"foo", 4, 0);
72 socks.first.send(
"foo", 4, 0);
82 using namespace literals::chrono_literals;
104 r.poll(CyclTime::now(), 0
ms);
111 r.poll(CyclTime::now(), 0
ms);
120 sub1.set_io_priority(Priority::High);
121 sub2.set_io_priority(Priority::Low);
123 std::this_thread::sleep_for(100
ms);
125 r.poll(CyclTime::now(), 0
ms);
132 sub1.set_io_priority(Priority::Low);
133 sub2.set_io_priority(Priority::High);
135 std::this_thread::sleep_for(100
ms);
137 r.poll(CyclTime::now(), 0
ms);
146 using namespace literals::chrono_literals;
180 now = WallClock::now();
189 audit_trail.push_back({.what = Audit::Entry, .fd = fd});
194 audit_trail.push_back({.what = Audit::Exit, .fd = fd});
201 audit_trail.push_back({.what = Audit::Entry, .fd = fd});
216 audit_trail.push_back({.what = Audit::Exit, .fd = fd});
232 sub_h0.set_io_priority(Priority::High);
233 sub_h1.set_io_priority(Priority::High);
240 r.poll(CyclTime::now(), 0
ms);
357 using namespace literals::chrono_literals;
365 const auto now = CyclTime::now();
369 socks.first.send(
"foo", 4, 0);
370 socks.first.send(
"foo", 4, 0);
386 socks.first.send(
"foo", 4, 0);
419 auto now = CyclTime::now();
423 r.timer(now.mono_time(), Priority::Low,
bind<&counter::operator()>(&
lpc)),
424 r.timer(now.mono_time(), Priority::Low,
bind<&counter::operator()>(&
lpc)),
430 const auto end = now.mono_time() + 95
ms;
435 while (now.mono_time() < end) {
438 hpt =
r.timer(now.mono_time(), Priority::High,
bind<&counter::operator()>(&
hpc));
447 now = CyclTime::now();
450 std::this_thread::sleep_for(10
ms);
454 for (
int i = 0;
i < 2;
i++) {
455 hpt =
r.timer(now.mono_time(), Priority::High,
bind<&counter::operator()>(&
hpc));
462 now = CyclTime::now();
BOOST_CHECK_EQUAL(v.size(), 10U)
BOOST_AUTO_TEST_CASE(ReactorLevelCase)