| 59 | } // namespace |
| 60 | |
| 61 | TEST(BufferAssemblerTests, ReassemblesRowStripsIntoContiguousBuffer) { |
| 62 | constexpr int stride = 8; |
| 63 | constexpr int height = 4; |
| 64 | constexpr std::size_t total = stride * height; |
| 65 | BufferAssembler a; |
| 66 | a.begin(make_begin("buf", 8, height, stride, total)); |
| 67 | |
| 68 | const auto full = iota_bytes(total); |
| 69 | |
| 70 | // Feed chunk 0: first 2 rows |
| 71 | ASSERT_TRUE( |
| 72 | a.chunk("buf", |
| 73 | 0, |
| 74 | 2, |
| 75 | std::span{full.data(), 2 * static_cast<std::size_t>(stride)})); |
| 76 | |
| 77 | // Feed chunk 1: next 2 rows |
| 78 | ASSERT_TRUE( |
| 79 | a.chunk("buf", |
| 80 | 2, |
| 81 | 2, |
| 82 | std::span{full.data() + 2 * static_cast<std::size_t>(stride), |
| 83 | 2 * static_cast<std::size_t>(stride)})); |
| 84 | |
| 85 | const auto result = a.end("buf"); |
| 86 | ASSERT_TRUE(result.has_value()); |
| 87 | EXPECT_EQ(result->bytes, full); |
| 88 | EXPECT_EQ(result->variable_name, "buf"); |
| 89 | } |
| 90 | |
| 91 | TEST(BufferAssemblerTests, RejectsChunkBeyondImageHeight) { |
| 92 | constexpr int stride = 8; |
nothing calls this directly
no test coverage detected