Lines Matching refs:reader
21 static void assert_eof(skiatest::Reporter* reporter, const SkReader32& reader) { in assert_eof() argument
22 REPORTER_ASSERT(reporter, reader.eof()); in assert_eof()
23 REPORTER_ASSERT(reporter, reader.size() == reader.offset()); in assert_eof()
24 REPORTER_ASSERT(reporter, (const char*)reader.peek() == in assert_eof()
25 (const char*)reader.base() + reader.size()); in assert_eof()
28 static void assert_start(skiatest::Reporter* reporter, const SkReader32& reader) { in assert_start() argument
29 REPORTER_ASSERT(reporter, 0 == reader.offset()); in assert_start()
30 REPORTER_ASSERT(reporter, reader.size() == reader.available()); in assert_start()
31 REPORTER_ASSERT(reporter, reader.isAvailable(reader.size())); in assert_start()
32 REPORTER_ASSERT(reporter, !reader.isAvailable(reader.size() + 1)); in assert_start()
33 REPORTER_ASSERT(reporter, reader.peek() == reader.base()); in assert_start()
36 static void assert_empty(skiatest::Reporter* reporter, const SkReader32& reader) { in assert_empty() argument
37 REPORTER_ASSERT(reporter, 0 == reader.size()); in assert_empty()
38 REPORTER_ASSERT(reporter, 0 == reader.offset()); in assert_empty()
39 REPORTER_ASSERT(reporter, 0 == reader.available()); in assert_empty()
40 REPORTER_ASSERT(reporter, !reader.isAvailable(1)); in assert_empty()
41 assert_eof(reporter, reader); in assert_empty()
42 assert_start(reporter, reader); in assert_empty()
46 SkReader32 reader; in Tests() local
47 assert_empty(reporter, reader); in Tests()
48 REPORTER_ASSERT(reporter, NULL == reader.base()); in Tests()
49 REPORTER_ASSERT(reporter, NULL == reader.peek()); in Tests()
59 reader.setMemory(data, sizeof(data)); in Tests()
61 REPORTER_ASSERT(reporter, sizeof(data) == reader.size()); in Tests()
62 REPORTER_ASSERT(reporter, i*4 == reader.offset()); in Tests()
63 REPORTER_ASSERT(reporter, (const void*)data == reader.base()); in Tests()
64 REPORTER_ASSERT(reporter, (const void*)&data[i] == reader.peek()); in Tests()
65 REPORTER_ASSERT(reporter, data[i] == reader.readInt()); in Tests()
67 assert_eof(reporter, reader); in Tests()
68 reader.rewind(); in Tests()
69 assert_start(reporter, reader); in Tests()
70 reader.read(buffer, sizeof(data)); in Tests()
73 reader.setMemory(data2, sizeof(data2)); in Tests()
75 REPORTER_ASSERT(reporter, sizeof(data2) == reader.size()); in Tests()
76 REPORTER_ASSERT(reporter, i*4 == reader.offset()); in Tests()
77 REPORTER_ASSERT(reporter, (const void*)data2 == reader.base()); in Tests()
78 REPORTER_ASSERT(reporter, (const void*)&data2[i] == reader.peek()); in Tests()
79 REPORTER_ASSERT(reporter, data2[i] == reader.readScalar()); in Tests()
81 assert_eof(reporter, reader); in Tests()
82 reader.rewind(); in Tests()
83 assert_start(reporter, reader); in Tests()
84 reader.read(buffer, sizeof(data2)); in Tests()
87 reader.setMemory(NULL, 0); in Tests()
88 assert_empty(reporter, reader); in Tests()
89 REPORTER_ASSERT(reporter, NULL == reader.base()); in Tests()
90 REPORTER_ASSERT(reporter, NULL == reader.peek()); in Tests()