11 #define BOOST_TEST_MODULE QueueingTest
12 #include <boost/test/included/unit_test.hpp>
25 for (
int i = 0;
i < num; ++
i)
26 tq.
insert(
static_cast<double>(
i), NULL);
28 BOOST_CHECK(tq.
pq_que_.size() == (num - 1));
32 while ((item = tq.
atomic_dq(5.0)) != NULL) {
36 BOOST_CHECK(cnter == 6);
37 BOOST_CHECK(tq.
pq_que_.size() == (num - 6 - 1));
40 while ((item = tq.
atomic_dq(8.0)) != NULL) {
45 BOOST_CHECK(cnter == num);
46 BOOST_CHECK(tq.
pq_que_.empty());
47 BOOST_CHECK(tq.
least() == NULL);
54 double time = double();
57 for (
int i = 0;
i < num; ++
i) {
58 time =
static_cast<double>(rand() % num);
65 while ((item = tq.
atomic_dq(10.0)) != NULL) {
66 BOOST_CHECK(time <= item->t_);
71 BOOST_CHECK(cnter == num);
72 BOOST_CHECK(tq.
pq_que_.empty());
73 BOOST_CHECK(tq.
least() == NULL);
83 for (
size_t i = 0;
i < num; ++
i)
86 BOOST_CHECK(nt.inter_thread_events_.size() == num);