Lines Matching refs:reporter

27 static void test_is_equal(skiatest::Reporter* reporter,  in test_is_equal()  argument
29 REPORTER_ASSERT(reporter, a->count() == b->count()); in test_is_equal()
34 REPORTER_ASSERT(reporter, sizea == sizeb); in test_is_equal()
35 REPORTER_ASSERT(reporter, !memcmp(mema, memb, sizea)); in test_is_equal()
39 static void test_datatable_is_empty(skiatest::Reporter* reporter, SkDataTable* table) { in test_datatable_is_empty() argument
40 REPORTER_ASSERT(reporter, table->isEmpty()); in test_datatable_is_empty()
41 REPORTER_ASSERT(reporter, 0 == table->count()); in test_datatable_is_empty()
44 static void test_emptytable(skiatest::Reporter* reporter) { in test_emptytable() argument
50 test_datatable_is_empty(reporter, table0.get()); in test_emptytable()
51 test_datatable_is_empty(reporter, table1.get()); in test_emptytable()
52 test_datatable_is_empty(reporter, table2.get()); in test_emptytable()
53 test_datatable_is_empty(reporter, table3.get()); in test_emptytable()
55 test_is_equal(reporter, table0.get(), table1.get()); in test_emptytable()
56 test_is_equal(reporter, table0.get(), table2.get()); in test_emptytable()
57 test_is_equal(reporter, table0.get(), table3.get()); in test_emptytable()
60 static void test_simpletable(skiatest::Reporter* reporter) { in test_simpletable() argument
64 REPORTER_ASSERT(reporter, itable->count() == icount); in test_simpletable()
67 REPORTER_ASSERT(reporter, sizeof(int) == itable->atSize(i)); in test_simpletable()
68 REPORTER_ASSERT(reporter, *itable->atT<int>(i, &size) == idata[i]); in test_simpletable()
69 REPORTER_ASSERT(reporter, sizeof(int) == size); in test_simpletable()
73 static void test_vartable(skiatest::Reporter* reporter) { in test_vartable() argument
85 REPORTER_ASSERT(reporter, table->count() == count); in test_vartable()
88 REPORTER_ASSERT(reporter, table->atSize(i) == sizes[i]); in test_vartable()
89 REPORTER_ASSERT(reporter, !strcmp(table->atT<const char>(i, &size), in test_vartable()
91 REPORTER_ASSERT(reporter, size == sizes[i]); in test_vartable()
94 REPORTER_ASSERT(reporter, strlen(s) == strlen(str[i])); in test_vartable()
98 static void test_globaltable(skiatest::Reporter* reporter) { in test_globaltable() argument
107 REPORTER_ASSERT(reporter, table->count() == count); in test_globaltable()
110 REPORTER_ASSERT(reporter, table->atSize(i) == sizeof(int)); in test_globaltable()
111 REPORTER_ASSERT(reporter, *table->atT<const char>(i, &size) == i); in test_globaltable()
112 REPORTER_ASSERT(reporter, sizeof(int) == size); in test_globaltable()
116 DEF_TEST(DataTable, reporter) { in DEF_TEST() argument
117 test_emptytable(reporter); in DEF_TEST()
118 test_simpletable(reporter); in DEF_TEST()
119 test_vartable(reporter); in DEF_TEST()
120 test_globaltable(reporter); in DEF_TEST()
131 static void assert_len(skiatest::Reporter* reporter, const sk_sp<SkData>& ref, size_t len) { in assert_len() argument
132 REPORTER_ASSERT(reporter, ref->size() == len); in assert_len()
135 static void assert_data(skiatest::Reporter* reporter, const sk_sp<SkData>& ref, in assert_data() argument
137 REPORTER_ASSERT(reporter, ref->size() == len); in assert_data()
138 REPORTER_ASSERT(reporter, !memcmp(ref->data(), data, len)); in assert_data()
141 static void test_cstring(skiatest::Reporter* reporter) { in test_cstring() argument
148 REPORTER_ASSERT(reporter, r0->equals(r1.get())); in test_cstring()
151 REPORTER_ASSERT(reporter, 1 == r2->size()); in test_cstring()
152 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); in test_cstring()
155 static void test_files(skiatest::Reporter* reporter) { in test_files() argument
167 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); in test_files()
175 REPORTER_ASSERT(reporter, r1.get() != nullptr); in test_files()
176 REPORTER_ASSERT(reporter, r1->size() == 26); in test_files()
177 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0); in test_files()
181 REPORTER_ASSERT(reporter, r2.get() != nullptr); in test_files()
182 REPORTER_ASSERT(reporter, r2->size() == 26); in test_files()
183 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0); in test_files()
186 DEF_TEST(Data, reporter) { in DEF_TEST() argument
195 assert_len(reporter, r0, 0); in DEF_TEST()
196 assert_len(reporter, r1, strlen(str)); in DEF_TEST()
197 assert_len(reporter, r2, N * sizeof(int)); in DEF_TEST()
198 assert_len(reporter, r3, 6); in DEF_TEST()
200 assert_data(reporter, r1, str, strlen(str)); in DEF_TEST()
201 assert_data(reporter, r3, "people", 6); in DEF_TEST()
204 assert_len(reporter, tmp, 0); in DEF_TEST()
206 assert_len(reporter, tmp, 0); in DEF_TEST()
208 test_cstring(reporter); in DEF_TEST()
209 test_files(reporter); in DEF_TEST()
216 static void check_abcs(skiatest::Reporter* reporter, const char buffer[], size_t size) { in check_abcs() argument
217 REPORTER_ASSERT(reporter, size % 26 == 0); in check_abcs()
219 REPORTER_ASSERT(reporter, !memcmp(&buffer[offset], gABC, 26)); in check_abcs()
224 static void check_alphabet_stream(skiatest::Reporter* reporter, SkStream* stream) { in check_alphabet_stream() argument
225 REPORTER_ASSERT(reporter, stream->hasLength()); in check_alphabet_stream()
227 REPORTER_ASSERT(reporter, size % 26 == 0); in check_alphabet_stream()
232 REPORTER_ASSERT(reporter, bytesRead == size); in check_alphabet_stream()
233 check_abcs(reporter, array, size); in check_alphabet_stream()
237 REPORTER_ASSERT(reporter, stream->seek(offset - 26)); in check_alphabet_stream()
238 REPORTER_ASSERT(reporter, stream->getPosition() == offset - 26); in check_alphabet_stream()
239 REPORTER_ASSERT(reporter, stream->read(array, 26) == 26); in check_alphabet_stream()
240 check_abcs(reporter, array, 26); in check_alphabet_stream()
241 REPORTER_ASSERT(reporter, stream->getPosition() == offset); in check_alphabet_stream()
246 static void check_alphabet_buffer(skiatest::Reporter* reporter, const SkROBuffer* reader) { in check_alphabet_buffer() argument
248 REPORTER_ASSERT(reporter, size % 26 == 0); in check_alphabet_buffer()
258 REPORTER_ASSERT(reporter, offset == size); in check_alphabet_buffer()
259 check_abcs(reporter, storage.get(), size); in check_alphabet_buffer()
262 DEF_TEST(RWBuffer, reporter) { in DEF_TEST() argument
276 REPORTER_ASSERT(reporter, N*26 == buffer.size()); in DEF_TEST()
281 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size()); in DEF_TEST()
282 check_alphabet_buffer(reporter, readers[i].get()); in DEF_TEST()
283 check_alphabet_stream(reporter, streams[i].get()); in DEF_TEST()
287 DEF_TEST(RWBuffer_threaded, reporter) { in DEF_TEST() argument
297 REPORTER_ASSERT(reporter, reader->size() == buffer.size()); in DEF_TEST()
298 REPORTER_ASSERT(reporter, stream->getLength() == buffer.size()); in DEF_TEST()
303 tasks.add([reporter, i, reader, stream] { in DEF_TEST()
304 REPORTER_ASSERT(reporter, (i + 1) * 26U == reader->size()); in DEF_TEST()
305 REPORTER_ASSERT(reporter, stream->getLength() == reader->size()); in DEF_TEST()
306 check_alphabet_buffer(reporter, reader.get()); in DEF_TEST()
307 check_alphabet_stream(reporter, stream); in DEF_TEST()
308 REPORTER_ASSERT(reporter, stream->rewind()); in DEF_TEST()
312 REPORTER_ASSERT(reporter, N*26 == buffer.size()); in DEF_TEST()