Lines Matching refs:Reporter
14 static void check_contents(skiatest::Reporter* reporter, const SkWriter32& writer,
17 REPORTER_ASSERT(reporter, writer.bytesWritten() == size);
19 REPORTER_ASSERT(reporter, !memcmp(storage.get(), expected, size));
23 static void test_reserve(skiatest::Reporter* reporter) {
31 static void test_string_null(skiatest::Reporter* reporter) {
38 check_contents(reporter, writer, expected, sizeof(expected));
41 static void test_rewind(skiatest::Reporter* reporter) {
45 REPORTER_ASSERT(reporter, 0 == writer.bytesWritten());
49 check_contents(reporter, writer, array, sizeof(array));
52 REPORTER_ASSERT(reporter, sizeof(array) - 4 == writer.bytesWritten());
54 REPORTER_ASSERT(reporter, sizeof(array) == writer.bytesWritten());
56 check_contents(reporter, writer, array, sizeof(array));
65 REPORTER_ASSERT(reporter, 100*4 == writer.bytesWritten());
69 REPORTER_ASSERT(reporter, writer.bytesWritten() < 16);
73 static void test_ptr(skiatest::Reporter* reporter) {
76 void* p0 = reporter;
88 REPORTER_ASSERT(reporter, 2 * sizeof(void*) + 2 * sizeof(int32_t));
95 REPORTER_ASSERT(reporter, reader.readPtr() == p0);
96 REPORTER_ASSERT(reporter, reader.readInt() == 0x33);
97 REPORTER_ASSERT(reporter, reader.readPtr() == p1);
98 REPORTER_ASSERT(reporter, reader.readInt() == 0x66);
101 static void test1(skiatest::Reporter* reporter, SkWriter32* writer) {
104 REPORTER_ASSERT(reporter, i*4 == writer->bytesWritten());
106 REPORTER_ASSERT(reporter, data[i] == writer->readTAt<uint32_t>(i * 4));
110 REPORTER_ASSERT(reporter, sizeof(buffer) == writer->bytesWritten());
112 REPORTER_ASSERT(reporter, !memcmp(data, buffer, sizeof(buffer)));
115 static void test2(skiatest::Reporter* reporter, SkWriter32* writer) {
124 REPORTER_ASSERT(reporter, writer->bytesWritten() == len);
132 REPORTER_ASSERT(reporter, !reader.eof());
134 REPORTER_ASSERT(reporter, i == len);
135 REPORTER_ASSERT(reporter, strlen(str) == len);
136 REPORTER_ASSERT(reporter, !memcmp(str, gStr, len));
140 REPORTER_ASSERT(reporter, 0 == str[j]);
143 REPORTER_ASSERT(reporter, reader.eof());
146 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
175 REPORTER_ASSERT(reporter, memcmp(readPtr, originalData.get(), len) == 0);
180 REPORTER_ASSERT(reporter, *readPtr++ == 0);
185 static void testOverwriteT(skiatest::Reporter* reporter, SkWriter32* writer) {
207 REPORTER_ASSERT(reporter, writer->readTAt<uint32_t>(padding) == uint1);
208 REPORTER_ASSERT(reporter, writer->readTAt<SkRect>(padding + sizeof(uint32_t)) == rect1);
209 REPORTER_ASSERT(reporter, writer->readTAt<SkScalar>(
216 REPORTER_ASSERT(reporter, writer->readTAt<uint32_t>(padding) == uint2);
217 REPORTER_ASSERT(reporter, writer->readTAt<SkRect>(padding + sizeof(uint32_t)) == rect2);
218 REPORTER_ASSERT(reporter, writer->readTAt<SkScalar>(
222 DEF_TEST(Writer32_dynamic, reporter) {
224 test1(reporter, &writer);
227 test2(reporter, &writer);
230 testWritePad(reporter, &writer);
233 testOverwriteT(reporter, &writer);
236 DEF_TEST(Writer32_small, reporter) {
238 test1(reporter, &writer);
240 test2(reporter, &writer);
243 testWritePad(reporter, &writer);
246 testOverwriteT(reporter, &writer);
249 DEF_TEST(Writer32_large, reporter) {
251 test1(reporter, &writer);
253 test2(reporter, &writer);
256 testWritePad(reporter, &writer);
259 testOverwriteT(reporter, &writer);
262 DEF_TEST(Writer32_misc, reporter) {
263 test_reserve(reporter);
264 test_string_null(reporter);
265 test_ptr(reporter);
266 test_rewind(reporter);
269 DEF_TEST(Writer32_data, reporter) {
285 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
289 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
293 REPORTER_ASSERT(reporter, sizeWritten == writer.bytesWritten());
302 REPORTER_ASSERT(reporter, 0 == d0->size());
303 REPORTER_ASSERT(reporter, strlen(str)+1 == d1->size());
304 REPORTER_ASSERT(reporter, !memcmp(str, d1->data(), strlen(str)+1));
305 REPORTER_ASSERT(reporter, 0 == d2->size());
307 REPORTER_ASSERT(reporter, reader.offset() == sizeWritten);
308 REPORTER_ASSERT(reporter, reader.eof());