MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / TEST

Function TEST

tests/test_buffer_assembler.cpp:61–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59} // namespace
60
61TEST(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
91TEST(BufferAssemblerTests, RejectsChunkBeyondImageHeight) {
92 constexpr int stride = 8;

Callers

nothing calls this directly

Calls 7

make_beginFunction · 0.85
iota_bytesFunction · 0.85
beginMethod · 0.80
chunkMethod · 0.80
endMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected