MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / TestDecode

Method TestDecode

test/tests/SawyerCodingTest.cpp:59–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58
59 void TestDecode(const uint8_t* data, size_t size)
60 {
61 auto expectedLength = size - sizeof(ChunkHeader);
62 auto chdr_in = reinterpret_cast<const ChunkHeader*>(data);
63 ASSERT_EQ(chdr_in->length, expectedLength);
64
65 MemoryStream ms(data, size);
66 SawyerChunkReader reader(&ms);
67 auto chunk = reader.ReadChunk();
68 ASSERT_EQ(chunk->GetEncoding(), chdr_in->encoding);
69 ASSERT_EQ(chunk->GetLength(), sizeof(randomdata));
70 auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
71 ASSERT_EQ(result, 0);
72 }
73};
74
75TEST_F(SawyerCodingTest, write_read_chunk_none)

Callers

nothing calls this directly

Calls 4

ReadChunkMethod · 0.80
GetEncodingMethod · 0.80
GetLengthMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected