Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: test/cctest/test-unbound-queue.cc

Issue 2091019: CPU profiler: make code events handling scalable. (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2010 the V8 project authors. All rights reserved.
2 //
3 // Tests of the unbound queue.
4
5 #include "v8.h"
6 #include "unbound-queue-inl.h"
7 #include "cctest.h"
8
9 namespace i = v8::internal;
10
11 using i::UnboundQueue;
12
13
14 TEST(SingleRecord) {
15 typedef int Record;
16 UnboundQueue<Record> cq;
17 CHECK(cq.IsEmpty());
18 cq.Enqueue(1);
19 CHECK(!cq.IsEmpty());
20 Record rec = 0;
21 cq.Dequeue(&rec);
22 CHECK_EQ(1, rec);
23 CHECK(cq.IsEmpty());
24 }
25
26
27 TEST(MultipleRecords) {
28 typedef int Record;
29 UnboundQueue<Record> cq;
30 CHECK(cq.IsEmpty());
31 cq.Enqueue(1);
32 CHECK(!cq.IsEmpty());
33 for (int i = 2; i <= 5; ++i) {
34 cq.Enqueue(i);
35 CHECK(!cq.IsEmpty());
36 }
37 Record rec = 0;
38 for (int i = 1; i <= 4; ++i) {
39 CHECK(!cq.IsEmpty());
40 cq.Dequeue(&rec);
41 CHECK_EQ(i, rec);
42 }
43 for (int i = 6; i <= 12; ++i) {
44 cq.Enqueue(i);
45 CHECK(!cq.IsEmpty());
46 }
47 for (int i = 5; i <= 12; ++i) {
48 CHECK(!cq.IsEmpty());
49 cq.Dequeue(&rec);
50 CHECK_EQ(i, rec);
51 }
52 CHECK(cq.IsEmpty());
53 }
54
OLDNEW
« src/unbound-queue.h ('K') | « test/cctest/test-circular-queue.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698