Lines Matching refs:reporter
18 static void test_is_equal(skiatest::Reporter* reporter, in test_is_equal() argument
20 REPORTER_ASSERT(reporter, a->count() == b->count()); in test_is_equal()
25 REPORTER_ASSERT(reporter, sizea == sizeb); in test_is_equal()
26 REPORTER_ASSERT(reporter, !memcmp(mema, memb, sizea)); in test_is_equal()
30 static void test_datatable_is_empty(skiatest::Reporter* reporter, SkDataTable* table) { in test_datatable_is_empty() argument
31 REPORTER_ASSERT(reporter, table->isEmpty()); in test_datatable_is_empty()
32 REPORTER_ASSERT(reporter, 0 == table->count()); in test_datatable_is_empty()
35 static void test_emptytable(skiatest::Reporter* reporter) { in test_emptytable() argument
41 test_datatable_is_empty(reporter, table0.get()); in test_emptytable()
42 test_datatable_is_empty(reporter, table1.get()); in test_emptytable()
43 test_datatable_is_empty(reporter, table2.get()); in test_emptytable()
44 test_datatable_is_empty(reporter, table3.get()); in test_emptytable()
46 test_is_equal(reporter, table0.get(), table1.get()); in test_emptytable()
47 test_is_equal(reporter, table0.get(), table2.get()); in test_emptytable()
48 test_is_equal(reporter, table0.get(), table3.get()); in test_emptytable()
51 static void test_simpletable(skiatest::Reporter* reporter) { in test_simpletable() argument
55 REPORTER_ASSERT(reporter, itable->count() == icount); in test_simpletable()
58 REPORTER_ASSERT(reporter, sizeof(int) == itable->atSize(i)); in test_simpletable()
59 REPORTER_ASSERT(reporter, *itable->atT<int>(i, &size) == idata[i]); in test_simpletable()
60 REPORTER_ASSERT(reporter, sizeof(int) == size); in test_simpletable()
64 static void test_vartable(skiatest::Reporter* reporter) { in test_vartable() argument
76 REPORTER_ASSERT(reporter, table->count() == count); in test_vartable()
79 REPORTER_ASSERT(reporter, table->atSize(i) == sizes[i]); in test_vartable()
80 REPORTER_ASSERT(reporter, !strcmp(table->atT<const char>(i, &size), in test_vartable()
82 REPORTER_ASSERT(reporter, size == sizes[i]); in test_vartable()
85 REPORTER_ASSERT(reporter, strlen(s) == strlen(str[i])); in test_vartable()
89 static void test_globaltable(skiatest::Reporter* reporter) { in test_globaltable() argument
98 REPORTER_ASSERT(reporter, table->count() == count); in test_globaltable()
101 REPORTER_ASSERT(reporter, table->atSize(i) == sizeof(int)); in test_globaltable()
102 REPORTER_ASSERT(reporter, *table->atT<const char>(i, &size) == i); in test_globaltable()
103 REPORTER_ASSERT(reporter, sizeof(int) == size); in test_globaltable()
107 DEF_TEST(DataTable, reporter) { in DEF_TEST() argument
108 test_emptytable(reporter); in DEF_TEST()
109 test_simpletable(reporter); in DEF_TEST()
110 test_vartable(reporter); in DEF_TEST()
111 test_globaltable(reporter); in DEF_TEST()
122 static void assert_len(skiatest::Reporter* reporter, const sk_sp<SkData>& ref, size_t len) { in assert_len() argument
123 REPORTER_ASSERT(reporter, ref->size() == len); in assert_len()
126 static void assert_data(skiatest::Reporter* reporter, const sk_sp<SkData>& ref, in assert_data() argument
128 REPORTER_ASSERT(reporter, ref->size() == len); in assert_data()
129 REPORTER_ASSERT(reporter, !memcmp(ref->data(), data, len)); in assert_data()
132 static void test_cstring(skiatest::Reporter* reporter) { in test_cstring() argument
139 REPORTER_ASSERT(reporter, r0->equals(r1.get())); in test_cstring()
142 REPORTER_ASSERT(reporter, 1 == r2->size()); in test_cstring()
143 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); in test_cstring()
146 static void test_files(skiatest::Reporter* reporter) { in test_files() argument
158 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); in test_files()
166 REPORTER_ASSERT(reporter, r1.get() != nullptr); in test_files()
167 REPORTER_ASSERT(reporter, r1->size() == 26); in test_files()
168 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0); in test_files()
172 REPORTER_ASSERT(reporter, r2.get() != nullptr); in test_files()
173 REPORTER_ASSERT(reporter, r2->size() == 26); in test_files()
174 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0); in test_files()
177 DEF_TEST(Data, reporter) { in DEF_TEST() argument
186 assert_len(reporter, r0, 0); in DEF_TEST()
187 assert_len(reporter, r1, strlen(str)); in DEF_TEST()
188 assert_len(reporter, r2, N * sizeof(int)); in DEF_TEST()
189 assert_len(reporter, r3, 6); in DEF_TEST()
191 assert_data(reporter, r1, str, strlen(str)); in DEF_TEST()
192 assert_data(reporter, r3, "people", 6); in DEF_TEST()
195 assert_len(reporter, tmp, 0); in DEF_TEST()
197 assert_len(reporter, tmp, 0); in DEF_TEST()
199 test_cstring(reporter); in DEF_TEST()
200 test_files(reporter); in DEF_TEST()
208 static void check_abcs(skiatest::Reporter* reporter, const char buffer[], size_t size) { in check_abcs() argument
209 REPORTER_ASSERT(reporter, size % 26 == 0); in check_abcs()
211 REPORTER_ASSERT(reporter, !memcmp(&buffer[offset], gABC, 26)); in check_abcs()
216 static void check_alphabet_stream(skiatest::Reporter* reporter, SkStream* stream) { in check_alphabet_stream() argument
217 REPORTER_ASSERT(reporter, stream->hasLength()); in check_alphabet_stream()
219 REPORTER_ASSERT(reporter, size % 26 == 0); in check_alphabet_stream()
224 REPORTER_ASSERT(reporter, bytesRead == size); in check_alphabet_stream()
225 check_abcs(reporter, array, size); in check_alphabet_stream()
229 REPORTER_ASSERT(reporter, stream->seek(offset - 26)); in check_alphabet_stream()
230 REPORTER_ASSERT(reporter, stream->getPosition() == offset - 26); in check_alphabet_stream()
231 REPORTER_ASSERT(reporter, stream->read(array, 26) == 26); in check_alphabet_stream()
232 check_abcs(reporter, array, 26); in check_alphabet_stream()
233 REPORTER_ASSERT(reporter, stream->getPosition() == offset); in check_alphabet_stream()
238 static void check_alphabet_buffer(skiatest::Reporter* reporter, const SkROBuffer* reader) { in check_alphabet_buffer() argument
240 REPORTER_ASSERT(reporter, size % 26 == 0); in check_alphabet_buffer()
250 REPORTER_ASSERT(reporter, offset == size); in check_alphabet_buffer()
251 check_abcs(reporter, storage.get(), size); in check_alphabet_buffer()
256 DEF_TEST(RWBuffer, reporter) { in DEF_TEST() argument
270 REPORTER_ASSERT(reporter, N*26 == buffer.size()); in DEF_TEST()
275 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size()); in DEF_TEST()
276 check_alphabet_buffer(reporter, readers[i].get()); in DEF_TEST()
277 check_alphabet_stream(reporter, streams[i].get()); in DEF_TEST()
281 DEF_TEST(RWBuffer_threaded, reporter) { in DEF_TEST() argument
291 REPORTER_ASSERT(reporter, reader->size() == buffer.size()); in DEF_TEST()
292 REPORTER_ASSERT(reporter, stream->getLength() == buffer.size()); in DEF_TEST()
297 tasks.add([reporter, i, reader, stream] { in DEF_TEST()
298 REPORTER_ASSERT(reporter, (i + 1) * 26U == reader->size()); in DEF_TEST()
299 REPORTER_ASSERT(reporter, stream->getLength() == reader->size()); in DEF_TEST()
300 check_alphabet_buffer(reporter, reader.get()); in DEF_TEST()
301 check_alphabet_stream(reporter, stream); in DEF_TEST()
302 REPORTER_ASSERT(reporter, stream->rewind()); in DEF_TEST()
306 REPORTER_ASSERT(reporter, N*26 == buffer.size()); in DEF_TEST()