| 34 | }; |
| 35 | |
| 36 | TEST_F(PrioritizedQueueTest, capacity) { |
| 37 | const unsigned min_cost = 10; |
| 38 | const unsigned max_tokens_per_subqueue = 50; |
| 39 | PQ pq(max_tokens_per_subqueue, min_cost); |
| 40 | EXPECT_TRUE(pq.empty()); |
| 41 | EXPECT_EQ(0u, pq.length()); |
| 42 | |
| 43 | pq.enqueue_strict(Klass(1), 0, Item(0)); |
| 44 | EXPECT_FALSE(pq.empty()); |
| 45 | EXPECT_EQ(1u, pq.length()); |
| 46 | |
| 47 | for (int i = 0; i < 3; i++) { |
| 48 | pq.enqueue(Klass(1), 0, 10, Item(0)); |
| 49 | } |
| 50 | for (unsigned i = 4; i > 0; i--) { |
| 51 | EXPECT_FALSE(pq.empty()); |
| 52 | EXPECT_EQ(i, pq.length()); |
| 53 | pq.dequeue(); |
| 54 | } |
| 55 | EXPECT_TRUE(pq.empty()); |
| 56 | EXPECT_EQ(0u, pq.length()); |
| 57 | } |
| 58 | |
| 59 | TEST_F(PrioritizedQueueTest, strict_pq) { |
| 60 | const unsigned min_cost = 1; |
nothing calls this directly
no test coverage detected