OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of the unbound queue. | 3 // Tests of the unbound queue. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 #include "unbound-queue-inl.h" | 6 #include "unbound-queue-inl.h" |
7 #include "cctest.h" | 7 #include "cctest.h" |
8 | 8 |
9 namespace i = v8::internal; | |
10 | |
11 using i::UnboundQueue; | 9 using i::UnboundQueue; |
12 | 10 |
13 | 11 |
14 TEST(SingleRecord) { | 12 TEST(SingleRecord) { |
15 typedef int Record; | 13 typedef int Record; |
16 UnboundQueue<Record> cq; | 14 UnboundQueue<Record> cq; |
17 CHECK(cq.IsEmpty()); | 15 CHECK(cq.IsEmpty()); |
18 cq.Enqueue(1); | 16 cq.Enqueue(1); |
19 CHECK(!cq.IsEmpty()); | 17 CHECK(!cq.IsEmpty()); |
20 Record rec = 0; | 18 Record rec = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
45 CHECK(!cq.IsEmpty()); | 43 CHECK(!cq.IsEmpty()); |
46 } | 44 } |
47 for (int i = 5; i <= 12; ++i) { | 45 for (int i = 5; i <= 12; ++i) { |
48 CHECK(!cq.IsEmpty()); | 46 CHECK(!cq.IsEmpty()); |
49 cq.Dequeue(&rec); | 47 cq.Dequeue(&rec); |
50 CHECK_EQ(i, rec); | 48 CHECK_EQ(i, rec); |
51 } | 49 } |
52 CHECK(cq.IsEmpty()); | 50 CHECK(cq.IsEmpty()); |
53 } | 51 } |
54 | 52 |
OLD | NEW |