Tests the raw data compression routines. More...
#include <cmath>
#include <limits>
#include <random>
#include <string>
#include <map>
#include <iostream>
#include "boost/test/unit_test.hpp"
#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h"
#include "larcoreobj/SimpleTypesAndConstants/RawTypes.h"
#include "lardataobj/RawData/raw.h"
Go to the source code of this file.
Classes | |
class | DataCreatorBase |
Interface of an object creating data to be tested on. More... | |
class | UniformNoiseCreator |
Data creator: uniformly random data, specified range plus offset (pedestal) More... | |
class | GaussianNoiseCreator |
Data creator: Gaussian random data. More... | |
class | SineWaveCreator |
Data creator: sine wave data. More... | |
class | RandomDataCreator |
Data creator: uniformly random data, full range. More... | |
Macros | |
#define | BOOST_TEST_MODULE ( raw_test ) |
Functions | |
void | RunDataCompressionTest (std::string id, const std::vector< short > &data, raw::Compress_t mode) |
Tests a data set with a given compression. More... | |
void | RunDataCompressionTests (DataCreatorBase *pDataCreator) |
Runs data compression tests with selected compression modes. More... | |
BOOST_AUTO_TEST_CASE (NullData) | |
BOOST_AUTO_TEST_CASE (ConstantData) | |
BOOST_AUTO_TEST_CASE (SmallUniformNoiseData) | |
BOOST_AUTO_TEST_CASE (SmallUniformNoiseOffsetData) | |
BOOST_AUTO_TEST_CASE (LargeUniformNoiseData) | |
BOOST_AUTO_TEST_CASE (SmallGaussianNoiseOffsetData) | |
BOOST_AUTO_TEST_CASE (LargeGaussianNoiseData) | |
BOOST_AUTO_TEST_CASE (VeryLowFrequencySineWaveData) | |
BOOST_AUTO_TEST_CASE (LowFrequencySineWaveData) | |
BOOST_AUTO_TEST_CASE (HighFrequencySineWaveData) | |
Variables | |
constexpr unsigned int | RandomSeed = 12345 |
The seed for the default random engine. More... | |
Tests the raw data compression routines.
This test covers only no compression and Huffman compression. If compresses a data set, uncompresses it back and checks that the result is the same as the original one. As such, it does not support lossy compression (like zero suppression).
See http://www.boost.org/libs/test for the Boost test library home page.
Timing: version 1.0 takes less than 3" on a 3 GHz machine
Definition in file raw_test.cc.
#define BOOST_TEST_MODULE ( raw_test ) |
Definition at line 37 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | NullData | ) |
Definition at line 291 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | ConstantData | ) |
Definition at line 296 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | SmallUniformNoiseData | ) |
Definition at line 301 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | SmallUniformNoiseOffsetData | ) |
Definition at line 306 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | LargeUniformNoiseData | ) |
Definition at line 311 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | SmallGaussianNoiseOffsetData | ) |
Definition at line 316 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | LargeGaussianNoiseData | ) |
Definition at line 321 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | VeryLowFrequencySineWaveData | ) |
Definition at line 326 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | LowFrequencySineWaveData | ) |
Definition at line 331 of file raw_test.cc.
BOOST_AUTO_TEST_CASE | ( | HighFrequencySineWaveData | ) |
Definition at line 336 of file raw_test.cc.
void RunDataCompressionTest | ( | std::string | id, |
const std::vector< short > & | data, | ||
raw::Compress_t | mode | ||
) |
Tests a data set with a given compression.
id | string representing the test (short descriptive text) |
data | data set (a vector of short integers) |
mode | compression mode to be tested |
The test consists in compressing and uncompressing back data. The test fails if the uncompressed data does not match the original one.
This is actually a single step of the full test implemented in RunDataCompressionTests.
Definition at line 214 of file raw_test.cc.
void RunDataCompressionTests | ( | DataCreatorBase * | pDataCreator | ) |
Runs data compression tests with selected compression modes.
pDataCreator | an object to create the input data set |
This function hard-codes some sets of parameters for the tests: the same test in RunDataCompressionTest() is repeated with different data size and different compression modes. This comprises the full test.
Definition at line 246 of file raw_test.cc.
constexpr unsigned int RandomSeed = 12345 |
The seed for the default random engine.
Definition at line 47 of file raw_test.cc.