| 161 | }; |
| 162 | |
| 163 | TEST_F(WeightedPriorityQueueTest, wpq_size){ |
| 164 | WQ wq(0, 0); |
| 165 | EXPECT_TRUE(wq.empty()); |
| 166 | EXPECT_EQ(0u, wq.get_size_slow()); |
| 167 | |
| 168 | // Test the strict queue size. |
| 169 | for (unsigned i = 1; i < 5; ++i) { |
| 170 | wq.enqueue_strict(Klass(i),i, std::make_tuple(i, i, i)); |
| 171 | EXPECT_FALSE(wq.empty()); |
| 172 | EXPECT_EQ(i, wq.get_size_slow()); |
| 173 | } |
| 174 | // Test the normal queue size. |
| 175 | for (unsigned i = 5; i < 10; ++i) { |
| 176 | wq.enqueue(Klass(i), i, i, std::make_tuple(i, i, i)); |
| 177 | EXPECT_FALSE(wq.empty()); |
| 178 | EXPECT_EQ(i, wq.get_size_slow()); |
| 179 | } |
| 180 | // Test that as both queues are emptied |
| 181 | // the size is correct. |
| 182 | for (unsigned i = 8; i >0; --i) { |
| 183 | wq.dequeue(); |
| 184 | EXPECT_FALSE(wq.empty()); |
| 185 | EXPECT_EQ(i, wq.get_size_slow()); |
| 186 | } |
| 187 | wq.dequeue(); |
| 188 | EXPECT_TRUE(wq.empty()); |
| 189 | EXPECT_EQ(0u, wq.get_size_slow()); |
| 190 | } |
| 191 | |
| 192 | TEST_F(WeightedPriorityQueueTest, wpq_test_static) { |
| 193 | test_queue(1000); |
nothing calls this directly
no test coverage detected