Home | History | Annotate | Download | only in tests

Lines Matching refs:reporter

16 static void test_is_equal(skiatest::Reporter* reporter,
18 REPORTER_ASSERT(reporter, a->count() == b->count());
23 REPORTER_ASSERT(reporter, sizea == sizeb);
24 REPORTER_ASSERT(reporter, !memcmp(mema, memb, sizea));
28 static void test_datatable_is_empty(skiatest::Reporter* reporter,
30 REPORTER_ASSERT(reporter, table->isEmpty());
31 REPORTER_ASSERT(reporter, 0 == table->count());
34 static void test_emptytable(skiatest::Reporter* reporter) {
41 test_datatable_is_empty(reporter, table0);
42 test_datatable_is_empty(reporter, table1);
43 test_datatable_is_empty(reporter, table2);
44 test_datatable_is_empty(reporter, table3);
46 test_is_equal(reporter, table0, table1);
47 test_is_equal(reporter, table0, table2);
48 test_is_equal(reporter, table0, table3);
51 static void test_simpletable(skiatest::Reporter* reporter) {
57 REPORTER_ASSERT(reporter, itable->count() == icount);
60 REPORTER_ASSERT(reporter, sizeof(int) == itable->atSize(i));
61 REPORTER_ASSERT(reporter, *itable->atT<int>(i, &size) == idata[i]);
62 REPORTER_ASSERT(reporter, sizeof(int) == size);
66 static void test_vartable(skiatest::Reporter* reporter) {
79 REPORTER_ASSERT(reporter, table->count() == count);
82 REPORTER_ASSERT(reporter, table->atSize(i) == sizes[i]);
83 REPORTER_ASSERT(reporter, !strcmp(table->atT<const char>(i, &size),
85 REPORTER_ASSERT(reporter, size == sizes[i]);
88 REPORTER_ASSERT(reporter, strlen(s) == strlen(str[i]));
92 static void test_tablebuilder(skiatest::Reporter* reporter) {
105 REPORTER_ASSERT(reporter, table->count() == count);
108 REPORTER_ASSERT(reporter, table->atSize(i) == strlen(str[i]) + 1);
109 REPORTER_ASSERT(reporter, !strcmp(table->atT<const char>(i, &size),
111 REPORTER_ASSERT(reporter, size == strlen(str[i]) + 1);
114 REPORTER_ASSERT(reporter, strlen(s) == strlen(str[i]));
118 static void test_globaltable(skiatest::Reporter* reporter) {
127 REPORTER_ASSERT(reporter, table->count() == count);
130 REPORTER_ASSERT(reporter, table->atSize(i) == sizeof(int));
131 REPORTER_ASSERT(reporter, *table->atT<const char>(i, &size) == i);
132 REPORTER_ASSERT(reporter, sizeof(int) == size);
136 DEF_TEST(DataTable, reporter) {
137 test_emptytable(reporter);
138 test_simpletable(reporter);
139 test_vartable(reporter);
140 test_tablebuilder(reporter);
141 test_globaltable(reporter);
152 static void assert_len(skiatest::Reporter* reporter, SkData* ref, size_t len) {
153 REPORTER_ASSERT(reporter, ref->size() == len);
156 static void assert_data(skiatest::Reporter* reporter, SkData* ref,
158 REPORTER_ASSERT(reporter, ref->size() == len);
159 REPORTER_ASSERT(reporter, !memcmp(ref->data(), data, len));
162 static void test_cstring(skiatest::Reporter* reporter) {
169 REPORTER_ASSERT(reporter, r0->equals(r1));
172 REPORTER_ASSERT(reporter, 1 == r2->size());
173 REPORTER_ASSERT(reporter, 0 == *r2->bytes());
176 static void test_files(skiatest::Reporter* reporter) {
188 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str());
196 REPORTER_ASSERT(reporter, r1.get() != NULL);
197 REPORTER_ASSERT(reporter, r1->size() == 26);
198 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 26) == 0);
202 REPORTER_ASSERT(reporter, r2.get() != NULL);
203 REPORTER_ASSERT(reporter, r2->size() == 26);
204 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0);
207 DEF_TEST(Data, reporter) {
217 assert_len(reporter, r0, 0);
218 assert_len(reporter, r1, strlen(str));
219 assert_len(reporter, r2, N * sizeof(int));
220 assert_len(reporter, r3, 6);
222 assert_data(reporter, r1, str, strlen(str));
223 assert_data(reporter, r3, "people", 6);
226 assert_len(reporter, tmp, 0);
229 assert_len(reporter, tmp, 0);
232 test_cstring(reporter);
233 test_files(reporter);
241 static void check_abcs(skiatest::Reporter* reporter, const char buffer[], size_t size) {
242 REPORTER_ASSERT(reporter, size % 26 == 0);
244 REPORTER_ASSERT(reporter, !memcmp(&buffer[offset], gABC, 26));
249 static void check_alphabet_stream(skiatest::Reporter* reporter, SkStream* stream) {
250 REPORTER_ASSERT(reporter, stream->hasLength());
252 REPORTER_ASSERT(reporter, size % 26 == 0);
257 REPORTER_ASSERT(reporter, bytesRead == size);
258 check_abcs(reporter, array, size);
262 REPORTER_ASSERT(reporter, stream->seek(offset - 26));
263 REPORTER_ASSERT(reporter, stream->getPosition() == offset - 26);
264 REPORTER_ASSERT(reporter, stream->read(array, 26) == 26);
265 check_abcs(reporter, array, 26);
266 REPORTER_ASSERT(reporter, stream->getPosition() == offset);
271 static void check_alphabet_buffer(skiatest::Reporter* reporter, const SkROBuffer* reader) {
273 REPORTER_ASSERT(reporter, size % 26 == 0);
283 REPORTER_ASSERT(reporter, offset == size);
284 check_abcs(reporter, storage.get(), size);
287 DEF_TEST(RWBuffer, reporter) {
305 REPORTER_ASSERT(reporter, N*26 == buffer.size());
309 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size());
310 check_alphabet_buffer(reporter, readers[i]);
311 check_alphabet_stream(reporter, streams[i]);