MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/jrd/tests/CompressorTest.cpp:14–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12BOOST_AUTO_TEST_SUITE(CompressorTests)
13
14BOOST_AUTO_TEST_CASE(PackAndUnpackTest)
15{
16 auto& pool = *getDefaultMemoryPool();
17
18 const UCHAR data[] = "111111111123456777777";
19 const auto dataLength = sizeof(data) - 1;
20 const Compressor dcc(pool, false, false, dataLength, data);
21
22 const auto packedLength = dcc.getPackedLength();
23 Array<UCHAR> packBuffer;
24 dcc.pack(data, packBuffer.getBuffer(packedLength, false));
25
26 Array<UCHAR> unpackBuffer;
27 unpackBuffer.getBuffer(Compressor::getUnpackedLength(packBuffer.getCount(), packBuffer.begin()), false);
28 BOOST_TEST(unpackBuffer.getCount() == dataLength);
29
30 BOOST_TEST(dcc.unpack(packBuffer.getCount(), packBuffer.begin(),
31 unpackBuffer.getCount(), unpackBuffer.begin()) == unpackBuffer.end());
32
33 BOOST_TEST(memcmp(data, unpackBuffer.begin(), dataLength) == 0);
34}
35
36BOOST_AUTO_TEST_SUITE_END() // CompressorTests
37

Callers

nothing calls this directly

Calls 8

getDefaultMemoryPoolFunction · 0.85
getPackedLengthMethod · 0.80
packMethod · 0.80
unpackMethod · 0.80
getBufferMethod · 0.45
getCountMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected