Scroom  0.14
compression-tests.cc File Reference
#include <cstring>
#include <boost/test/unit_test.hpp>
#include "blob-compression.hh"
Include dependency graph for compression-tests.cc:

Functions

 BOOST_AUTO_TEST_CASE (compression_decompression_retains_data)
 
 BOOST_AUTO_TEST_CASE (compression_decompression_retains_data_with_large_blocks)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( compression_decompression_retains_data  )
22 {
23  const size_t blobSize = 16 * 1024;
24  const size_t blockCount = 16;
25  const size_t blockSize = 64;
26 
27  uint8_t in[blobSize];
28  for(size_t i = 0; i < blobSize; i++)
29  {
30  in[i] = i / 256 + i % 256;
31  }
32 
33  PageProvider::Ptr const provider = PageProvider::create(blockCount, blockSize);
34 
35  PageList const l = compressBlob(in, blobSize, provider);
36 
37  uint8_t out[blobSize];
38  decompressBlob(out, blobSize, l, provider);
39 
40  BOOST_CHECK(!memcmp(in, out, blobSize));
41 }
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( compression_decompression_retains_data_with_large_blocks  )
44 {
45  const size_t blobSize = 16;
46  const size_t blockCount = 16;
47  const size_t blockSize = 256;
48 
49  uint8_t in[blobSize];
50  for(size_t i = 0; i < blobSize; i++)
51  {
52  in[i] = i / 256 + i % 256;
53  }
54 
55  PageProvider::Ptr const provider = PageProvider::create(blockCount, blockSize);
56 
57  PageList const l = compressBlob(in, blobSize, provider);
58 
59  uint8_t out[blobSize];
60  decompressBlob(out, blobSize, l, provider);
61 
62  BOOST_CHECK(!memcmp(in, out, blobSize));
63 }
Here is the call graph for this function:
Scroom::MemoryBlobs::PageProvider::Ptr
boost::shared_ptr< PageProvider > Ptr
Definition: memoryblobs.hh:41
Scroom::MemoryBlobs::PageList
std::list< Page::Ptr > PageList
Definition: memoryblobs.hh:36
Scroom::MemoryBlobs::Detail::compressBlob
PageList compressBlob(const uint8_t *in, size_t size, const PageProvider::Ptr &provider)
Definition: blob-compression.cc:30
Scroom::MemoryBlobs::Detail::decompressBlob
void decompressBlob(uint8_t *out, size_t size, PageList list, const PageProvider::Ptr &provider)
Definition: blob-compression.cc:70
out
SampleIterator< uint8_t > out(output, 0, bps)
create
void create(NewPresentationInterface *interface)
Definition: loader.cc:175