| 103 | } |
| 104 | |
| 105 | void AssertChunking(Chunker& chunker, std::shared_ptr<Buffer> buf, int total_count) { |
| 106 | // First chunkize whole JSON block |
| 107 | AssertWholeObjects(chunker, buf, total_count); |
| 108 | |
| 109 | // Then chunkize incomplete substrings of the block |
| 110 | for (int i = 0; i < total_count; ++i) { |
| 111 | // ensure shearing the closing brace off the last object causes it to be chunked out |
| 112 | auto last_brace = string_view(*buf).find_last_of('}'); |
| 113 | AssertWholeObjects(chunker, SliceBuffer(buf, 0, last_brace), total_count - i - 1); |
| 114 | |
| 115 | // ensure skipping one object reduces the count by one |
| 116 | ASSERT_NE(ConsumeWholeObject(&buf), string_view::npos); |
| 117 | AssertWholeObjects(chunker, buf, total_count - i - 1); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | void AssertChunkingBlockSize(Chunker& chunker, std::shared_ptr<Buffer> buf, |
| 122 | int64_t block_size, int expected_count) { |
no test coverage detected