Lines Matching refs:deq
11 static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int count) {
13 REPORTER_ASSERT(reporter, deq.empty());
14 REPORTER_ASSERT(reporter, 0 == deq.count());
15 REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
16 REPORTER_ASSERT(reporter, nullptr == deq.front());
17 REPORTER_ASSERT(reporter, nullptr == deq.back());
19 REPORTER_ASSERT(reporter, !deq.empty());
20 REPORTER_ASSERT(reporter, count == deq.count());
21 REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
22 REPORTER_ASSERT(reporter, deq.front());
23 REPORTER_ASSERT(reporter, deq.back());
25 REPORTER_ASSERT(reporter, deq.back() == deq.front());
27 REPORTER_ASSERT(reporter, deq.back() != deq.front());
32 static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq,
35 SkDeque::Iter iter(deq, SkDeque::Iter::kFront_IterStart);
46 iter.reset(deq, SkDeque::Iter::kBack_IterStart);
56 iter.reset(deq, SkDeque::Iter::kFront_IterStart);
60 for (int i = 0; i < deq.count()/2 && (ptr = iter.next()); i++) {
78 DequeUnitTestHelper(const SkDeque& deq) {
79 fNumBlocksAllocated = deq.numBlocksAllocated();
84 const SkDeque& deq,
86 DequeUnitTestHelper helper(deq);
88 if (0 == deq.count()) {
91 int expected = (deq.count() + allocCount - 1) / allocCount;
101 SkDeque deq(sizeof(int), allocCount);
106 assert_count(reporter, deq, 0);
108 *(int*)deq.push_front() = i;
110 assert_count(reporter, deq, 10);
111 assert_iter(reporter, deq, 10, 1);
112 assert_blocks(reporter, deq, allocCount);
115 deq.pop_front();
117 assert_count(reporter, deq, 5);
118 assert_iter(reporter, deq, 5, 1);
119 assert_blocks(reporter, deq, allocCount);
122 deq.pop_front();
124 assert_count(reporter, deq, 0);
125 assert_blocks(reporter, deq, allocCount);
130 *(int*)deq.push_back() = i;
132 assert_count(reporter, deq, 10);
133 assert_iter(reporter, deq, 10, 1);
134 assert_blocks(reporter, deq, allocCount);
137 deq.pop_back();
139 assert_count(reporter, deq, 5);
140 assert_iter(reporter, deq, 10, 6);
141 assert_blocks(reporter, deq, allocCount);
144 deq.pop_back();
146 assert_count(reporter, deq, 0);
147 assert_blocks(reporter, deq, allocCount);
151 *(int*)deq.push_front() = 5;
152 *(int*)deq.push_back() = 4;
153 *(int*)deq.push_front() = 6;
154 *(int*)deq.push_back() = 3;
155 *(int*)deq.push_front() = 7;
156 *(int*)deq.push_back() = 2;
157 *(int*)deq.push_front() = 8;
158 *(int*)deq.push_back() = 1;
159 assert_count(reporter, deq, 8);
160 assert_iter(reporter, deq, 8, 1);
161 assert_blocks(reporter, deq, allocCount);