Lines Matching refs:Reporter
17 static void test_is_equal(skiatest::Reporter* reporter,
19 REPORTER_ASSERT(reporter, a->count() == b->count());
24 REPORTER_ASSERT(reporter, sizea == sizeb);
25 REPORTER_ASSERT(reporter, !memcmp(mema, memb, sizea));
29 static void test_datatable_is_empty(skiatest::Reporter* reporter, SkDataTable* table) {
30 REPORTER_ASSERT(reporter, table->isEmpty());
31 REPORTER_ASSERT(reporter, 0 == table->count());
34 static void test_emptytable(skiatest::Reporter* reporter) {
40 test_datatable_is_empty(reporter, table0.get());
41 test_datatable_is_empty(reporter, table1.get());
42 test_datatable_is_empty(reporter, table2.get());
43 test_datatable_is_empty(reporter, table3.get());
45 test_is_equal(reporter, table0.get(), table1.get());
46 test_is_equal(reporter, table0.get(), table2.get());
47 test_is_equal(reporter, table0.get(), table3.get());
50 static void test_simpletable(skiatest::Reporter* reporter) {
54 REPORTER_ASSERT(reporter, itable->count() == icount);
57 REPORTER_ASSERT(reporter, sizeof(int) == itable->atSize(i));
58 REPORTER_ASSERT(reporter, *itable->atT<int>(i, &size) == idata[i]);
59 REPORTER_ASSERT(reporter, sizeof(int) == size);
63 static void test_vartable(skiatest::Reporter* reporter) {
75 REPORTER_ASSERT(reporter, table->count() == count);
78 REPORTER_ASSERT(reporter, table->atSize(i) == sizes[i]);
79 REPORTER_ASSERT(reporter, !strcmp(table->atT<const char>(i, &size),
81 REPORTER_ASSERT(reporter, size == sizes[i]);
84 REPORTER_ASSERT(reporter, strlen(s) == strlen(str[i]));
88 static void test_globaltable(skiatest::Reporter* reporter) {
97 REPORTER_ASSERT(reporter, table->count() == count);
100 REPORTER_ASSERT(reporter, table->atSize(i) == sizeof(int));
101 REPORTER_ASSERT(reporter, *table->atT<const char>(i, &size) == i);
102 REPORTER_ASSERT(reporter, sizeof(int) == size);
106 DEF_TEST(DataTable, reporter) {
107 test_emptytable(reporter);
108 test_simpletable(reporter);
109 test_vartable(reporter);
110 test_globaltable(reporter);
121 static void assert_len(skiatest::Reporter* reporter, const sk_sp<SkData>& ref, size_t len) {
122 REPORTER_ASSERT(reporter, ref->size() == len);
125 static void assert_data(skiatest::Reporter* reporter, const sk_sp<SkData>& ref,
127 REPORTER_ASSERT(reporter, ref->size() == len);
128 REPORTER_ASSERT(reporter, !memcmp(ref->data(), data, len));
131 static void test_cstring(skiatest::Reporter* reporter) {
138 REPORTER_ASSERT(reporter, r0->equals(r1.get()));
141 REPORTER_ASSERT(reporter, 1 == r2->size());
142 REPORTER_ASSERT(reporter, 0 == *r2->bytes());
145 static void test_files(skiatest::Reporter* reporter) {
157 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str());
165 REPORTER_ASSERT(reporter, r1.get() != nullptr);
166 REPORTER_ASSERT(reporter, r1->size() == 26);
167 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0);
171 REPORTER_ASSERT(reporter, r2.get() != nullptr);
172 REPORTER_ASSERT(reporter, r2->size() == 26);
173 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0);
176 DEF_TEST(Data, reporter) {
185 assert_len(reporter, r0, 0);
186 assert_len(reporter, r1, strlen(str));
187 assert_len(reporter, r2, N * sizeof(int));
188 assert_len(reporter, r3, 6);
190 assert_data(reporter, r1, str, strlen(str));
191 assert_data(reporter, r3, "people", 6);
194 assert_len(reporter, tmp, 0);
196 assert_len(reporter, tmp, 0);
198 test_cstring(reporter);
199 test_files(reporter);
207 static void check_abcs(skiatest::Reporter* reporter, const char buffer[], size_t size) {
208 REPORTER_ASSERT(reporter, size % 26 == 0);
210 REPORTER_ASSERT(reporter, !memcmp(&buffer[offset], gABC, 26));
215 static void check_alphabet_stream(skiatest::Reporter* reporter, SkStream* stream) {
216 REPORTER_ASSERT(reporter, stream->hasLength());
218 REPORTER_ASSERT(reporter, size % 26 == 0);
223 REPORTER_ASSERT(reporter, bytesRead == size);
224 check_abcs(reporter, array, size);
228 REPORTER_ASSERT(reporter, stream->seek(offset - 26));
229 REPORTER_ASSERT(reporter, stream->getPosition() == offset - 26);
230 REPORTER_ASSERT(reporter, stream->read(array, 26) == 26);
231 check_abcs(reporter, array, 26);
232 REPORTER_ASSERT(reporter, stream->getPosition() == offset);
237 static void check_alphabet_buffer(skiatest::Reporter* reporter, const SkROBuffer* reader) {
239 REPORTER_ASSERT(reporter, size % 26 == 0);
249 REPORTER_ASSERT(reporter, offset == size);
250 check_abcs(reporter, storage.get(), size);
255 DEF_TEST(RWBuffer, reporter) {
269 REPORTER_ASSERT(reporter, N*26 == buffer.size());
274 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size());
275 check_alphabet_buffer(reporter, readers[i]);
276 check_alphabet_stream(reporter, streams[i]);
282 DEF_TEST(RWBuffer_threaded, reporter) {
292 REPORTER_ASSERT(reporter, reader->size() == buffer.size());
293 REPORTER_ASSERT(reporter, stream->getLength() == buffer.size());
298 tasks.add([reporter, i, reader, stream] {
299 REPORTER_ASSERT(reporter, (i + 1) * 26U == reader->size());
300 REPORTER_ASSERT(reporter, stream->getLength() == reader->size());
301 check_alphabet_buffer(reporter, reader.get());
302 check_alphabet_stream(reporter, stream);
303 REPORTER_ASSERT(reporter, stream->rewind());
307 REPORTER_ASSERT(reporter, N*26 == buffer.size());