Lines Matching refs:Reporter
16 static void test_read(skiatest::Reporter* reporter, SkStream* bufferedStream,
22 REPORTER_ASSERT(reporter, bytesRead == bytesToRead || bufferedStream->isAtEnd());
23 REPORTER_ASSERT(reporter, memcmp(storage.get(), expectations, bytesRead) == 0);
26 static void test_rewind(skiatest::Reporter* reporter,
29 REPORTER_ASSERT(reporter, success == shouldSucceed);
36 static void test_hasLength(skiatest::Reporter* reporter,
40 REPORTER_ASSERT(reporter, bufferedStream.hasLength());
42 REPORTER_ASSERT(reporter, !bufferedStream.hasLength());
53 static void test_incremental_buffering(skiatest::Reporter* reporter, size_t bufferSize) {
60 test_hasLength(reporter, *bufferedStream, *memStream);
63 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 2);
67 test_rewind(reporter, bufferedStream.get(), true);
68 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 4);
71 test_read(reporter, bufferedStream.get(), gAbcs + bufferSize / 4, bufferSize / 2);
75 test_rewind(reporter, bufferedStream.get(), true);
76 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize << 1);
81 test_rewind(reporter, bufferedStream.get(), false);
84 static void test_perfectly_sized_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
87 test_hasLength(reporter, *bufferedStream, *memStream);
90 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize);
93 test_rewind(reporter, bufferedStream.get(), true);
96 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize);
99 test_read(reporter, bufferedStream.get(), gAbcs + memStream->getPosition(), 1);
100 test_rewind(reporter, bufferedStream.get(), false);
103 static void test_skipping(skiatest::Reporter* reporter, size_t bufferSize) {
106 test_hasLength(reporter, *bufferedStream, *memStream);
112 test_rewind(reporter, bufferedStream.get(), true);
113 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 4);
119 test_read(reporter, bufferedStream.get(), gAbcs + memStream->getPosition(), bufferSize / 4);
121 test_rewind(reporter, bufferedStream.get(), true);
122 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize);
153 static void test_read_beyond_buffer(skiatest::Reporter* reporter, size_t bufferSize) {
160 test_hasLength(reporter, *bufferedStream.get(), *memStream);
163 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize + 1);
164 test_rewind(reporter, bufferedStream.get(), true);
167 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize);
201 static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize) {
207 test_hasLength(reporter, *buffered.get(), *stream);
213 static void test_initial_offset(skiatest::Reporter* reporter, size_t bufferSize) {
223 REPORTER_ASSERT(reporter, bufferedStream->hasLength());
233 REPORTER_ASSERT(reporter, !bufferedStream->isAtEnd());
234 test_read(reporter, bufferedStream.get(), gAbcs + arbitraryOffset + currentPosition,
237 REPORTER_ASSERT(reporter, memStream->getPosition() - arbitraryOffset == currentPosition);
239 REPORTER_ASSERT(reporter, bufferedStream->isAtEnd());
240 REPORTER_ASSERT(reporter, bufferedLength == currentPosition);
243 static void test_buffers(skiatest::Reporter* reporter, size_t bufferSize) {
244 test_incremental_buffering(reporter, bufferSize);
245 test_perfectly_sized_buffer(reporter, bufferSize);
246 test_skipping(reporter, bufferSize);
247 test_read_beyond_buffer(reporter, bufferSize);
248 test_length_combos(reporter, bufferSize);
249 test_initial_offset(reporter, bufferSize);
252 DEF_TEST(FrontBufferedStream, reporter) {
254 test_buffers(reporter, 6);
255 test_buffers(reporter, 15);
256 test_buffers(reporter, 64);
282 DEF_TEST(ShortFrontBufferedStream, reporter) {