Project
Loading...
Searching...
No Matches
testDigitIO.cxx File Reference
#include <boost/test/tools/old/interface.hpp>
#include <sstream>
#include "DigitFileFormat.h"
#include <boost/test/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include "DigitIO.h"
#include <algorithm>
#include <fmt/format.h>
#include <fstream>
#include "DataFormatsMCH/Digit.h"
#include "DataFormatsMCH/ROFRecord.h"
#include <cassert>
#include <array>
#include <stdexcept>
#include "DigitSamplerImpl.h"
#include "IO.h"

Go to the source code of this file.

Classes

struct  TF
 

Macros

#define BOOST_TEST_MODULE   Test MCHWorkflow DigitsIO
 
#define BOOST_TEST_MAIN
 
#define BOOST_TEST_DYN_LINK
 

Functions

DigitFileFormat createFormat (uint8_t fileVersion, uint8_t digitVersion, uint8_t digitSize, uint8_t rofVersion, uint8_t rofSize, bool run2ids, bool hasRof)
 
 BOOST_AUTO_TEST_CASE (DigitFileFormatV0Value)
 
 BOOST_AUTO_TEST_CASE (DigitFileFormatV1Value)
 
 BOOST_AUTO_TEST_CASE (DigitFileFormatV2Value)
 
 BOOST_AUTO_TEST_CASE (DigitFileFormatV3Value)
 
 BOOST_AUTO_TEST_CASE (DigitFileFormatV4Value)
 
 BOOST_DATA_TEST_CASE (WriteMustReturnFalseIfDigitVectorIsEmpty, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (BinaryWriteMustReturnFalseIfRofVectorIsEmpty, digitFileFormats, digitFileFormat)
 
 BOOST_AUTO_TEST_CASE (DefaultFormatIsTheTag)
 
 BOOST_DATA_TEST_CASE (ReaderMustIdentifyFileFormat, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (BinaryWriterMustTagCorrectly, digitFileFormats, digitFileFormat)
 
std::vector< o2::mch::DigitcreateDummyFixedDigits (int n)
 
TF createDummyData (int ndigits, int nrofs, uint32_t firstOrbit)
 
void writeTestData (std::ostream &out, DigitFileFormat dff)
 
 BOOST_DATA_TEST_CASE (TestDataDump, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (TestDataIsOfExpectedFormat, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (TestDataHasExpectedNofROFs, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (TestDataHasExpectedNofTFs, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (TestDataHasExpectedNumberOfDigitsWhenReading, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (TestDataHasExpectedNumberOfDigitsWhenCounting, digitFileFormats, digitFileFormat)
 
 BOOST_DATA_TEST_CASE (CheckReader, digitFileFormats, digitFileFormat)
 

Variables

constexpr int NROF_1 = 1
 
constexpr int NROF_2 = 1
 
constexpr int NROF_3 = 1
 
constexpr int NROF_4 = 3
 
constexpr int NROFS = NROF_1 + NROF_2 + NROF_3 + NROF_4
 
std::vector< TFtestData
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 17 of file testDigitIO.cxx.

◆ BOOST_TEST_MAIN

#define BOOST_TEST_MAIN

Definition at line 16 of file testDigitIO.cxx.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Test MCHWorkflow DigitsIO

Definition at line 15 of file testDigitIO.cxx.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/6]

BOOST_AUTO_TEST_CASE ( DefaultFormatIsTheTag  )

Definition at line 121 of file testDigitIO.cxx.

◆ BOOST_AUTO_TEST_CASE() [2/6]

BOOST_AUTO_TEST_CASE ( DigitFileFormatV0Value  )

Definition at line 55 of file testDigitIO.cxx.

◆ BOOST_AUTO_TEST_CASE() [3/6]

BOOST_AUTO_TEST_CASE ( DigitFileFormatV1Value  )

Definition at line 61 of file testDigitIO.cxx.

◆ BOOST_AUTO_TEST_CASE() [4/6]

BOOST_AUTO_TEST_CASE ( DigitFileFormatV2Value  )

Definition at line 67 of file testDigitIO.cxx.

◆ BOOST_AUTO_TEST_CASE() [5/6]

BOOST_AUTO_TEST_CASE ( DigitFileFormatV3Value  )

Definition at line 73 of file testDigitIO.cxx.

◆ BOOST_AUTO_TEST_CASE() [6/6]

BOOST_AUTO_TEST_CASE ( DigitFileFormatV4Value  )

Definition at line 79 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [1/11]

BOOST_DATA_TEST_CASE ( BinaryWriteMustReturnFalseIfRofVectorIsEmpty  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 104 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [2/11]

BOOST_DATA_TEST_CASE ( BinaryWriterMustTagCorrectly  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 137 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [3/11]

BOOST_DATA_TEST_CASE ( CheckReader  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 275 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [4/11]

BOOST_DATA_TEST_CASE ( ReaderMustIdentifyFileFormat  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 127 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [5/11]

BOOST_DATA_TEST_CASE ( TestDataDump  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 210 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [6/11]

BOOST_DATA_TEST_CASE ( TestDataHasExpectedNofROFs  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 229 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [7/11]

BOOST_DATA_TEST_CASE ( TestDataHasExpectedNofTFs  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 238 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [8/11]

BOOST_DATA_TEST_CASE ( TestDataHasExpectedNumberOfDigitsWhenCounting  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 266 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [9/11]

BOOST_DATA_TEST_CASE ( TestDataHasExpectedNumberOfDigitsWhenReading  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 251 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [10/11]

BOOST_DATA_TEST_CASE ( TestDataIsOfExpectedFormat  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 220 of file testDigitIO.cxx.

◆ BOOST_DATA_TEST_CASE() [11/11]

BOOST_DATA_TEST_CASE ( WriteMustReturnFalseIfDigitVectorIsEmpty  ,
digitFileFormats  ,
digitFileFormat   
)

Definition at line 85 of file testDigitIO.cxx.

◆ createDummyData()

TF createDummyData ( int  ndigits,
int  nrofs,
uint32_t  firstOrbit 
)

Definition at line 166 of file testDigitIO.cxx.

◆ createDummyFixedDigits()

std::vector< o2::mch::Digit > createDummyFixedDigits ( int  n)

Definition at line 145 of file testDigitIO.cxx.

◆ createFormat()

DigitFileFormat createFormat ( uint8_t  fileVersion,
uint8_t  digitVersion,
uint8_t  digitSize,
uint8_t  rofVersion,
uint8_t  rofSize,
bool  run2ids,
bool  hasRof 
)

Definition at line 36 of file testDigitIO.cxx.

◆ writeTestData()

void writeTestData ( std::ostream &  out,
DigitFileFormat  dff 
)

Definition at line 200 of file testDigitIO.cxx.

Variable Documentation

◆ NROF_1

constexpr int NROF_1 = 1
constexpr

The test data is used to check the internal consistency of the reader and writer (i.e. data written by the writer must be readable by the reader). A complete test requires, in addition, the usage of externally created data (see for instance V0File in testDigitIOV0)

Definition at line 187 of file testDigitIO.cxx.

◆ NROF_2

constexpr int NROF_2 = 1
constexpr

Definition at line 188 of file testDigitIO.cxx.

◆ NROF_3

constexpr int NROF_3 = 1
constexpr

Definition at line 189 of file testDigitIO.cxx.

◆ NROF_4

constexpr int NROF_4 = 3
constexpr

Definition at line 190 of file testDigitIO.cxx.

◆ NROFS

constexpr int NROFS = NROF_1 + NROF_2 + NROF_3 + NROF_4
constexpr

Definition at line 191 of file testDigitIO.cxx.

◆ testData

std::vector<TF> testData
Initial value:
{
}
constexpr int NROF_4
constexpr int NROF_2
constexpr int NROF_3
TF createDummyData(int ndigits, int nrofs, uint32_t firstOrbit)
constexpr int NROF_1

Definition at line 193 of file testDigitIO.cxx.