Lines Matching refs:reporter

16 static void TestTSet_basic(skiatest::Reporter* reporter) {
20 REPORTER_ASSERT(reporter, a.empty());
21 REPORTER_ASSERT(reporter, a.count() == 0);
25 REPORTER_ASSERT(reporter, !a.empty());
26 REPORTER_ASSERT(reporter, a.count() == 1);
30 REPORTER_ASSERT(reporter, a.empty());
31 REPORTER_ASSERT(reporter, a.count() == 0);
35 REPORTER_ASSERT(reporter, a.push_back() = 1);
37 REPORTER_ASSERT(reporter, !a.empty());
38 REPORTER_ASSERT(reporter, a.count() == 1);
39 REPORTER_ASSERT(reporter, a[0] == 1);
44 REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b));
45 REPORTER_ASSERT(reporter, a[2] == 2);
46 REPORTER_ASSERT(reporter, a[4] == 4);
50 REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 1);
51 REPORTER_ASSERT(reporter, a[3] == 3);
55 REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 2);
56 REPORTER_ASSERT(reporter, a[0] == 0);
57 REPORTER_ASSERT(reporter, a[1] == 3);
58 REPORTER_ASSERT(reporter, a[2] == 2);
63 template <typename T> static void test_construction(skiatest::Reporter* reporter) {
66 REPORTER_ASSERT(reporter, arrayNoArgs.empty());
70 REPORTER_ASSERT(reporter, arrayReserve.empty());
71 REPORTER_ASSERT(reporter, arrayReserve.capacity() == 15);
80 REPORTER_ASSERT(reporter, arrayInitial.size() == 3);
81 REPORTER_ASSERT(reporter, arrayInitial[0] == 1);
82 REPORTER_ASSERT(reporter, arrayInitial[1] == 2);
83 REPORTER_ASSERT(reporter, arrayInitial[2] == 3);
84 REPORTER_ASSERT(reporter, arrayCopy.size() == 3);
85 REPORTER_ASSERT(reporter, arrayCopy[0] == 1);
86 REPORTER_ASSERT(reporter, arrayCopy[1] == 2);
87 REPORTER_ASSERT(reporter, arrayCopy[2] == 3);
91 REPORTER_ASSERT(reporter, arrayInitial.empty()); // NOLINT(bugprone-use-after-move)
92 REPORTER_ASSERT(reporter, arrayMove.size() == 3);
93 REPORTER_ASSERT(reporter, arrayMove[0] == 1);
94 REPORTER_ASSERT(reporter, arrayMove[1] == 2);
95 REPORTER_ASSERT(reporter, arrayMove[2] == 3);
100 REPORTER_ASSERT(reporter, arrayPtrCount.size() == 3);
101 REPORTER_ASSERT(reporter, arrayPtrCount[0] == 7);
102 REPORTER_ASSERT(reporter, arrayPtrCount[1] == 8);
103 REPORTER_ASSERT(reporter, arrayPtrCount[2] == 9);
107 REPORTER_ASSERT(reporter, arrayInitializer.size() == 7);
108 REPORTER_ASSERT(reporter, arrayInitializer[0] == 8);
109 REPORTER_ASSERT(reporter, arrayInitializer[1] == 6);
110 REPORTER_ASSERT(reporter, arrayInitializer[2] == 7);
111 REPORTER_ASSERT(reporter, arrayInitializer[3] == 5);
112 REPORTER_ASSERT(reporter, arrayInitializer[4] == 3);
113 REPORTER_ASSERT(reporter, arrayInitializer[5] == 0);
114 REPORTER_ASSERT(reporter, arrayInitializer[6] == 9);
118 static void test_skstarray_compatibility(skiatest::Reporter* reporter) {
130 REPORTER_ASSERT(reporter, tArray.size() == 3);
131 REPORTER_ASSERT(reporter, tArray[0] == 1);
132 REPORTER_ASSERT(reporter, tArray[1] == 2);
133 REPORTER_ASSERT(reporter, tArray[2] == 3);
134 REPORTER_ASSERT(reporter, arrayCopy.size() == 3);
135 REPORTER_ASSERT(reporter, arrayCopy[0] == 1);
136 REPORTER_ASSERT(reporter, arrayCopy[1] == 2);
137 REPORTER_ASSERT(reporter, arrayCopy[2] == 3);
142 REPORTER_ASSERT(reporter, tArray.size() == 3);
143 REPORTER_ASSERT(reporter, tArray[0] == 1);
144 REPORTER_ASSERT(reporter, tArray[1] == 2);
145 REPORTER_ASSERT(reporter, tArray[2] == 3);
146 REPORTER_ASSERT(reporter, arrayAssignment.size() == 3);
147 REPORTER_ASSERT(reporter, arrayAssignment[0] == 1);
148 REPORTER_ASSERT(reporter, arrayAssignment[1] == 2);
149 REPORTER_ASSERT(reporter, arrayAssignment[2] == 3);
153 REPORTER_ASSERT(reporter, tArray.empty()); // NOLINT(bugprone-use-after-move)
154 REPORTER_ASSERT(reporter, arrayMove.size() == 3);
155 REPORTER_ASSERT(reporter, arrayMove[0] == 1);
156 REPORTER_ASSERT(reporter, arrayMove[1] == 2);
157 REPORTER_ASSERT(reporter, arrayMove[2] == 3);
162 REPORTER_ASSERT(reporter, tArray2.empty()); // NOLINT(bugprone-use-after-move)
163 REPORTER_ASSERT(reporter, arrayMoveAssign.size() == 3);
164 REPORTER_ASSERT(reporter, arrayMoveAssign[0] == 1);
165 REPORTER_ASSERT(reporter, arrayMoveAssign[1] == 2);
166 REPORTER_ASSERT(reporter, arrayMoveAssign[2] == 3);
169 template <typename T> static void test_swap(skiatest::Reporter* reporter,
189 REPORTER_ASSERT(reporter, b->count() == sizeA);
190 REPORTER_ASSERT(reporter, a->count() == sizeB);
193 for (auto&& x : *b) { REPORTER_ASSERT(reporter, x == curr++); }
194 for (auto&& x : *a) { REPORTER_ASSERT(reporter, x == curr++); }
198 for (auto&& x : *a) { REPORTER_ASSERT(reporter, x == curr++); }
203 static void test_swap(skiatest::Reporter* reporter) {
211 test_swap(reporter, arrays, sizes);
225 test_swap(reporter, arraysMoi, sizes);
228 void test_unnecessary_alloc(skiatest::Reporter* reporter) {
231 REPORTER_ASSERT(reporter, a.capacity() == 0);
235 REPORTER_ASSERT(reporter, a.capacity() == 10);
239 REPORTER_ASSERT(reporter, a.capacity() >= 1);
244 REPORTER_ASSERT(reporter, b.capacity() == 0);
250 REPORTER_ASSERT(reporter, b.capacity() == 0);
255 REPORTER_ASSERT(reporter, b.capacity() == 0);
260 REPORTER_ASSERT(reporter, b.capacity() == 0);
265 REPORTER_ASSERT(reporter, b.capacity() == 0);
270 REPORTER_ASSERT(reporter, b.capacity() == 0);
276 REPORTER_ASSERT(reporter, b.capacity() == 0);
282 REPORTER_ASSERT(reporter, b.capacity() == 0);
286 static void test_self_assignment(skiatest::Reporter* reporter) {
289 REPORTER_ASSERT(reporter, !a.empty());
290 REPORTER_ASSERT(reporter, a.count() == 1);
291 REPORTER_ASSERT(reporter, a[0] == 1);
294 REPORTER_ASSERT(reporter, !a.empty());
295 REPORTER_ASSERT(reporter, a.count() == 1);
296 REPORTER_ASSERT(reporter, a[0] == 1);
299 template <typename Array> static void test_array_reserve(skiatest::Reporter* reporter,
302 REPORTER_ASSERT(reporter, array->capacity() >= reserveCount);
304 REPORTER_ASSERT(reporter, array->capacity() >= reserveCount);
306 REPORTER_ASSERT(reporter, array->capacity() >= reserveCount);
314 REPORTER_ASSERT(reporter, array->capacity() >= reserveCount);
318 template<typename Array> static void test_reserve(skiatest::Reporter* reporter) {
324 test_array_reserve(reporter, &array1, reserveCount);
329 test_array_reserve(reporter, &array2, reserveCount);
334 test_array_reserve(reporter, &array3, reserveCount);
341 test_array_reserve(reporter, &array4, 2 * reserveCount);
345 DEF_TEST(TArray, reporter) {
346 TestTSet_basic<true>(reporter);
347 TestTSet_basic<false>(reporter);
348 test_swap(reporter);
350 test_unnecessary_alloc(reporter);
352 test_self_assignment(reporter);
354 test_reserve<SkTArray<int>>(reporter);
355 test_reserve<SkSTArray<1, int>>(reporter);
356 test_reserve<SkSTArray<2, int>>(reporter);
357 test_reserve<SkSTArray<16, int>>(reporter);
359 test_construction<SkTArray<int>>(reporter);
360 test_construction<SkTArray<double>>(reporter);
361 test_construction<SkSTArray<1, int>>(reporter);
362 test_construction<SkSTArray<5, char>>(reporter);
363 test_construction<SkSTArray<10, float>>(reporter);
365 test_skstarray_compatibility<SkSTArray<1, int>, SkTArray<int>>(reporter);
366 test_skstarray_compatibility<SkSTArray<5, char>, SkTArray<char>>(reporter);
367 test_skstarray_compatibility<SkSTArray<10, float>, SkTArray<float>>(reporter);
368 test_skstarray_compatibility<SkTArray<int>, SkSTArray<1, int>>(reporter);
369 test_skstarray_compatibility<SkTArray<char>, SkSTArray<5, char>>(reporter);
370 test_skstarray_compatibility<SkTArray<float>, SkSTArray<10, float>>(reporter);
371 test_skstarray_compatibility<SkSTArray<10, uint8_t>, SkSTArray<1, uint8_t>>(reporter);
372 test_skstarray_compatibility<SkSTArray<1, long>, SkSTArray<10, long>>(reporter);
373 test_skstarray_compatibility<SkSTArray<3, double>, SkSTArray<4, double>>(reporter);
374 test_skstarray_compatibility<SkSTArray<2, short>, SkSTArray<1, short>>(reporter);