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

Function TEST

src/Core/tests/MemoryStreamTests.cpp:8–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace OpenLoco;
7
8TEST(MemoryStreamTest, testWriteRead)
9{
10 MemoryStream ms;
11
12 const std::array<uint8_t, 4> writeBuffer{ 0x01, 0x02, 0x03, 0x04 };
13 ms.write(writeBuffer.data(), writeBuffer.size());
14
15 ASSERT_EQ(ms.getLength(), sizeof(writeBuffer));
16 ASSERT_EQ(ms.getPosition(), sizeof(writeBuffer));
17
18 ms.setPosition(0);
19 ASSERT_EQ(ms.getPosition(), 0);
20
21 std::array<uint8_t, 4> readBuffer{};
22 ms.read(readBuffer.data(), readBuffer.size());
23
24 ASSERT_EQ(readBuffer, writeBuffer);
25}
26
27TEST(MemoryStreamTest, testOverwrite)
28{

Callers

nothing calls this directly

Calls 8

writeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
getLengthMethod · 0.45
getPositionMethod · 0.45
setPositionMethod · 0.45
readMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected