9 #include "../LarsoftHuffmanCompressService.h" 17 using std::istringstream;
25 const string myname =
"test_LarsoftHuffmanCompressService: ";
27 cout << myname <<
"NDEBUG must be off." <<
endl;
30 string line =
"-----------------------------";
33 cout << myname <<
"Testing with UseBlock=" << useBlock
34 <<
", useHuffman=" << useHuffman
35 <<
", LogLevel=" << logLevel
43 const unsigned int nadc = 3200;
45 cout << myname <<
" Initial ADC size: " << adc0.size() <<
endl;
46 assert( adc0.size() == nadc );
54 cout << myname <<
"Compressing." <<
endl;
55 int rstat = cmp.
compress(adc1, keep, offset, ctypeout);
56 cout << myname <<
" Return status: " << rstat <<
endl;
57 cout << myname <<
" Compressed ADC size: " << adc1.size() <<
endl;
58 cout << myname <<
" Compression type: " << ctypeexp <<
endl;
60 assert( ctypeout == ctypeexp );
61 assert( adc1.size() > 0 );
66 cout << myname <<
"Uncompressing." <<
endl;
69 cout << myname <<
"Uncompressed ADC size: " << adc2.size() <<
endl;
70 assert( adc2.size() == adc0.size() );
72 for (
unsigned int iadc=0; iadc<adc0.size(); ++iadc ) {
73 if ( adc0[iadc] != adc2[iadc] ) {
74 cout << myname <<
" Mismatch for entry " << iadc <<
": " << adc0[iadc] <<
" != " << adc2[iadc] <<
endl;
76 if ( nbad > 20 )
break;
80 assert( uoffset == offset );
82 cout << myname <<
"Done." <<
endl;
89 istringstream ssarg(argv[1]);
enum raw::_compress Compress_t
std::vector< short > AdcVector
Zero Suppression followed by Huffman Encoding.
Zero Suppression algorithm.
std::vector< short > AdcVector
std::vector< bool > AdcFilterVector
void line(double t, double *p, double &x, double &y, double &z)
int compress(AdcCountVector &sigs, const AdcFilterVector &keep, AdcCount offset, raw::Compress_t &comp) const
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
int main(int argc, char *argv[])
int test_LarsoftHuffmanCompressService(bool useBlock, bool useHuffman, int logLevel)
QTextStream & endl(QTextStream &s)