Home | History | Annotate | Download | only in tests

Lines Matching refs:Reporter

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