ChimeraTK-DeviceAccess 03.27.00
Loading...
Searching...
No Matches
testRawConverter.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "Exception.h"
#include "RawConverter.h"
#include <cfloat>
#include <sstream>
+ Include dependency graph for testRawConverter.cpp:

Go to the source code of this file.

Classes

class  FixedPointConverter< RawType >
 
class  IEEE754_SingleConverter
 

Namespaces

namespace  ChimeraTK
 

Macros

#define BOOST_TEST_DYN_LINK
 
#define BOOST_TEST_MODULE   RawConverterTest
 
#define HEX_TO_DOUBLE(INPUT)   static_cast<double>(INPUT)
 
#define SIGNED_HEX_TO_DOUBLE(INPUT)   static_cast<double>(static_cast<int32_t>(INPUT))
 
#define SIGNED_HEX_TO_INT64(INPUT)   static_cast<int64_t>(static_cast<int32_t>(INPUT))
 
#define CHECK_SIGNED_FIXED_POINT_NO_FRACTIONAL
 
#define DEF_TYPENAME(name)
 

Typedefs

using DEPRECATED_FIXEDPOINT_DEFAULT = int32_t
 

Functions

template<typename T >
const char * typeName (void)
 
template<typename T >
void checkToCookedOverflowNeg (FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &converter, uint32_t input)
 
template<typename T >
void checkToCookedOverflowPos (FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &converter, uint32_t input)
 
template<typename T >
void checkToCooked (FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &converter, uint32_t input, T expectedValue, const std::string &msg=std::string(""))
 
template<typename T >
void checkToRaw (FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &converter, T input, uint32_t expectedValue, const std::string &msg=std::string(""))
 
 BOOST_AUTO_TEST_CASE (testInt32)
 
 BOOST_AUTO_TEST_CASE (testUInt32)
 
 BOOST_AUTO_TEST_CASE (testInt16)
 
 BOOST_AUTO_TEST_CASE (testUInt16)
 
 BOOST_AUTO_TEST_CASE (testInt8)
 
 BOOST_AUTO_TEST_CASE (testUInt8)
 
 BOOST_AUTO_TEST_CASE (testInt32_fractionMinus12)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fractionMinus12)
 
 BOOST_AUTO_TEST_CASE (testInt32_fractionMinus1)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fractionMinus1)
 
 BOOST_AUTO_TEST_CASE (testInt16_fractionMinus1)
 
 BOOST_AUTO_TEST_CASE (testUInt16_fractionMinus1)
 
 BOOST_AUTO_TEST_CASE (testInt32_fraction1)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fraction1)
 
 BOOST_AUTO_TEST_CASE (testInt32_fraction7)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fraction7)
 
 BOOST_AUTO_TEST_CASE (testInt32_fraction31)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fraction31)
 
 BOOST_AUTO_TEST_CASE (testInt32_fraction32)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fraction32)
 
 BOOST_AUTO_TEST_CASE (testInt18_fractionMinus12)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fractionMinus12)
 
 BOOST_AUTO_TEST_CASE (testInt18_fraction0)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fraction0)
 
 BOOST_AUTO_TEST_CASE (testInt18_fraction7)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fraction7)
 
 BOOST_AUTO_TEST_CASE (testInt18_fraction17)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fraction17)
 
 BOOST_AUTO_TEST_CASE (testInt18_fraction18)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fraction18)
 
 BOOST_AUTO_TEST_CASE (testInt32ToInt32)
 
 BOOST_AUTO_TEST_CASE (testInt32ToInt16)
 
 BOOST_AUTO_TEST_CASE (testInt18ToInt32)
 
 BOOST_AUTO_TEST_CASE (testIntSignedToUnsigned)
 
 BOOST_AUTO_TEST_CASE (testInt17SignedToInt16Unsigned)
 
 BOOST_AUTO_TEST_CASE (testBoolean0)
 
 BOOST_AUTO_TEST_CASE (testVoid)
 
 BOOST_AUTO_TEST_CASE (TestString)
 
 BOOST_AUTO_TEST_CASE (test_toCooked_3_25)
 
 BOOST_AUTO_TEST_CASE (test_toCooked_60k)
 
 BOOST_AUTO_TEST_CASE (test_toCooked_minus240)
 
void checkAsRaw (int32_t rawValue, float expectedValue)
 
 BOOST_AUTO_TEST_CASE (test_from_3_25)
 
 BOOST_AUTO_TEST_CASE (TestCornerCases)
 
 BOOST_AUTO_TEST_CASE (test_toCooked_00)
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 4 of file testRawConverter.cpp.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   RawConverterTest

Definition at line 5 of file testRawConverter.cpp.

◆ CHECK_SIGNED_FIXED_POINT_NO_FRACTIONAL

#define CHECK_SIGNED_FIXED_POINT_NO_FRACTIONAL
Value:
checkToFixedPoint(converter, 0.25, 0); \
checkToFixedPoint(converter, -0.25, 0); \
checkToFixedPoint(converter, 0.75, 1); \
checkToFixedPoint(converter, -0.75, -1); \
checkToFixedPoint(converter, 3.25, 3); \
checkToFixedPoint(converter, -3.25, -3); \
checkToFixedPoint(converter, 5.75, 6); \
checkToFixedPoint(converter, -5.75, -6);

Definition at line 28 of file testRawConverter.cpp.

◆ DEF_TYPENAME

#define DEF_TYPENAME (   name)
Value:
template<> \
inline const char* typeName<name>(void) { \
return #name; \
}

Definition at line 53 of file testRawConverter.cpp.

◆ HEX_TO_DOUBLE

#define HEX_TO_DOUBLE (   INPUT)    static_cast<double>(INPUT)

Definition at line 24 of file testRawConverter.cpp.

◆ SIGNED_HEX_TO_DOUBLE

#define SIGNED_HEX_TO_DOUBLE (   INPUT)    static_cast<double>(static_cast<int32_t>(INPUT))

Definition at line 25 of file testRawConverter.cpp.

◆ SIGNED_HEX_TO_INT64

#define SIGNED_HEX_TO_INT64 (   INPUT)    static_cast<int64_t>(static_cast<int32_t>(INPUT))

Definition at line 26 of file testRawConverter.cpp.

Typedef Documentation

◆ DEPRECATED_FIXEDPOINT_DEFAULT

Definition at line 71 of file testRawConverter.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/44]

BOOST_AUTO_TEST_CASE ( test_from_3_25  )

Definition at line 1819 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/44]

BOOST_AUTO_TEST_CASE ( test_toCooked_00  )

Definition at line 1847 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/44]

BOOST_AUTO_TEST_CASE ( test_toCooked_3_25  )

Definition at line 1747 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [4/44]

BOOST_AUTO_TEST_CASE ( test_toCooked_60k  )

Definition at line 1768 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [5/44]

BOOST_AUTO_TEST_CASE ( test_toCooked_minus240  )

Definition at line 1791 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [6/44]

BOOST_AUTO_TEST_CASE ( testBoolean0  )

Definition at line 1672 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [7/44]

BOOST_AUTO_TEST_CASE ( TestCornerCases  )

Definition at line 1836 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [8/44]

BOOST_AUTO_TEST_CASE ( testInt16  )

Definition at line 273 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [9/44]

BOOST_AUTO_TEST_CASE ( testInt16_fractionMinus1  )

Definition at line 612 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [10/44]

BOOST_AUTO_TEST_CASE ( testInt17SignedToInt16Unsigned  )

Definition at line 1564 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [11/44]

BOOST_AUTO_TEST_CASE ( testInt18_fraction0  )

Definition at line 1173 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [12/44]

BOOST_AUTO_TEST_CASE ( testInt18_fraction17  )

Definition at line 1317 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [13/44]

BOOST_AUTO_TEST_CASE ( testInt18_fraction18  )

Definition at line 1361 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [14/44]

BOOST_AUTO_TEST_CASE ( testInt18_fraction7  )

Definition at line 1248 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [15/44]

BOOST_AUTO_TEST_CASE ( testInt18_fractionMinus12  )

Definition at line 1105 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [16/44]

BOOST_AUTO_TEST_CASE ( testInt18ToInt32  )

Definition at line 1515 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [17/44]

BOOST_AUTO_TEST_CASE ( testInt32  )

Definition at line 176 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [18/44]

BOOST_AUTO_TEST_CASE ( testInt32_fraction1  )

Definition at line 686 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [19/44]

BOOST_AUTO_TEST_CASE ( testInt32_fraction31  )

Definition at line 857 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [20/44]

BOOST_AUTO_TEST_CASE ( testInt32_fraction32  )

Definition at line 946 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [21/44]

BOOST_AUTO_TEST_CASE ( testInt32_fraction7  )

Definition at line 772 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [22/44]

BOOST_AUTO_TEST_CASE ( testInt32_fractionMinus1  )

Definition at line 538 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [23/44]

BOOST_AUTO_TEST_CASE ( testInt32_fractionMinus12  )

Definition at line 452 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [24/44]

BOOST_AUTO_TEST_CASE ( testInt32ToInt16  )

Definition at line 1490 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [25/44]

BOOST_AUTO_TEST_CASE ( testInt32ToInt32  )

Definition at line 1468 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [26/44]

BOOST_AUTO_TEST_CASE ( testInt8  )

Definition at line 363 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [27/44]

BOOST_AUTO_TEST_CASE ( testIntSignedToUnsigned  )

Definition at line 1542 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [28/44]

BOOST_AUTO_TEST_CASE ( TestString  )

Definition at line 1687 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [29/44]

BOOST_AUTO_TEST_CASE ( testUInt16  )

Definition at line 319 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [30/44]

BOOST_AUTO_TEST_CASE ( testUInt16_fractionMinus1  )

Definition at line 653 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [31/44]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction0  )

Definition at line 1214 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [32/44]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction17  )

Definition at line 1339 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [33/44]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction18  )

Definition at line 1388 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [34/44]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction7  )

Definition at line 1280 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [35/44]

BOOST_AUTO_TEST_CASE ( testUInt18_fractionMinus12  )

Definition at line 1138 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [36/44]

BOOST_AUTO_TEST_CASE ( testUInt32  )

Definition at line 225 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [37/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction1  )

Definition at line 731 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [38/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction31  )

Definition at line 901 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [39/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction32  )

Definition at line 987 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [40/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction7  )

Definition at line 820 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [41/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fractionMinus1  )

Definition at line 579 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [42/44]

BOOST_AUTO_TEST_CASE ( testUInt32_fractionMinus12  )

Definition at line 496 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [43/44]

BOOST_AUTO_TEST_CASE ( testUInt8  )

Definition at line 408 of file testRawConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [44/44]

BOOST_AUTO_TEST_CASE ( testVoid  )

Definition at line 1679 of file testRawConverter.cpp.

◆ checkAsRaw()

void checkAsRaw ( int32_t  rawValue,
float  expectedValue 
)

Definition at line 1812 of file testRawConverter.cpp.

◆ checkToCooked()

template<typename T >
void checkToCooked ( FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &  converter,
uint32_t  input,
expectedValue,
const std::string &  msg = std::string("") 
)

Definition at line 118 of file testRawConverter.cpp.

◆ checkToCookedOverflowNeg()

template<typename T >
void checkToCookedOverflowNeg ( FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &  converter,
uint32_t  input 
)

Definition at line 108 of file testRawConverter.cpp.

◆ checkToCookedOverflowPos()

template<typename T >
void checkToCookedOverflowPos ( FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &  converter,
uint32_t  input 
)

Definition at line 113 of file testRawConverter.cpp.

◆ checkToRaw()

template<typename T >
void checkToRaw ( FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > const &  converter,
input,
uint32_t  expectedValue,
const std::string &  msg = std::string("") 
)

Definition at line 138 of file testRawConverter.cpp.

◆ typeName()

template<typename T >
const char * typeName ( void  )
inline

Definition at line 50 of file testRawConverter.cpp.