ChimeraTK-DeviceAccess  03.18.00
testFixedPointConverter.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "Exception.h"
#include "FixedPointConverter.h"
#include <sstream>
+ Include dependency graph for testFixedPointConverter.cpp:

Go to the source code of this file.

Namespaces

 ChimeraTK
 

Macros

#define BOOST_TEST_DYN_LINK
 
#define BOOST_TEST_MODULE   FixedPointConverterTest
 
#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)
 

Functions

template<typename T >
const char * typeName (void)
 
template<typename T >
void checkToCookedOverflowNeg (FixedPointConverter const &converter, uint32_t input)
 
template<typename T >
void checkToCookedOverflowPos (FixedPointConverter const &converter, uint32_t input)
 
template<typename T >
void checkToCooked (FixedPointConverter const &converter, uint32_t input, T expectedValue)
 
template<typename T >
void checkToRaw (FixedPointConverter const &converter, T input, uint32_t expectedValue)
 
 BOOST_AUTO_TEST_CASE (testConstructor)
 
 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 (testInt32_fraction43)
 
 BOOST_AUTO_TEST_CASE (testUInt32_fraction43)
 
 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 (testInt18_fraction43)
 
 BOOST_AUTO_TEST_CASE (testUInt18_fraction43)
 
 BOOST_AUTO_TEST_CASE (testGetters)
 
 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 (testInt0unsigned)
 
 BOOST_AUTO_TEST_CASE (testInt0signed)
 
 BOOST_AUTO_TEST_CASE (testInt0unsignedFractional)
 
 BOOST_AUTO_TEST_CASE (testInt0signedFractional)
 
 BOOST_AUTO_TEST_CASE (testDynamicRangePos)
 
 BOOST_AUTO_TEST_CASE (testDynamicRangeNeg)
 
 BOOST_AUTO_TEST_CASE (testBoolean0)
 
 BOOST_AUTO_TEST_CASE (testVoid)
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 4 of file testFixedPointConverter.cpp.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   FixedPointConverterTest

Definition at line 5 of file testFixedPointConverter.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 testFixedPointConverter.cpp.

◆ DEF_TYPENAME

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

Definition at line 52 of file testFixedPointConverter.cpp.

◆ HEX_TO_DOUBLE

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

Definition at line 24 of file testFixedPointConverter.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 testFixedPointConverter.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 testFixedPointConverter.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/49]

BOOST_AUTO_TEST_CASE ( testBoolean0  )

Definition at line 1617 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/49]

BOOST_AUTO_TEST_CASE ( testConstructor  )

Definition at line 112 of file testFixedPointConverter.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/49]

BOOST_AUTO_TEST_CASE ( testDynamicRangeNeg  )

Definition at line 1605 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/49]

BOOST_AUTO_TEST_CASE ( testDynamicRangePos  )

Definition at line 1593 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/49]

BOOST_AUTO_TEST_CASE ( testGetters  )

Definition at line 1402 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/49]

BOOST_AUTO_TEST_CASE ( testInt0signed  )

Definition at line 1545 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/49]

BOOST_AUTO_TEST_CASE ( testInt0signedFractional  )

Definition at line 1577 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/49]

BOOST_AUTO_TEST_CASE ( testInt0unsigned  )

Definition at line 1529 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/49]

BOOST_AUTO_TEST_CASE ( testInt0unsignedFractional  )

Definition at line 1561 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/49]

BOOST_AUTO_TEST_CASE ( testInt16  )

Definition at line 222 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/49]

BOOST_AUTO_TEST_CASE ( testInt16_fractionMinus1  )

Definition at line 560 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/49]

BOOST_AUTO_TEST_CASE ( testInt17SignedToInt16Unsigned  )

Definition at line 1509 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/49]

BOOST_AUTO_TEST_CASE ( testInt18_fraction0  )

Definition at line 1119 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/49]

BOOST_AUTO_TEST_CASE ( testInt18_fraction17  )

Definition at line 1263 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/49]

BOOST_AUTO_TEST_CASE ( testInt18_fraction18  )

Definition at line 1307 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/49]

BOOST_AUTO_TEST_CASE ( testInt18_fraction43  )

Definition at line 1358 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [17/49]

BOOST_AUTO_TEST_CASE ( testInt18_fraction7  )

Definition at line 1194 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [18/49]

BOOST_AUTO_TEST_CASE ( testInt18_fractionMinus12  )

Definition at line 1051 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [19/49]

BOOST_AUTO_TEST_CASE ( testInt18ToInt32  )

Definition at line 1461 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [20/49]

BOOST_AUTO_TEST_CASE ( testInt32  )

Definition at line 126 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [21/49]

BOOST_AUTO_TEST_CASE ( testInt32_fraction1  )

Definition at line 632 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [22/49]

BOOST_AUTO_TEST_CASE ( testInt32_fraction31  )

Definition at line 803 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [23/49]

BOOST_AUTO_TEST_CASE ( testInt32_fraction32  )

Definition at line 892 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [24/49]

BOOST_AUTO_TEST_CASE ( testInt32_fraction43  )

Definition at line 973 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [25/49]

BOOST_AUTO_TEST_CASE ( testInt32_fraction7  )

Definition at line 718 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [26/49]

BOOST_AUTO_TEST_CASE ( testInt32_fractionMinus1  )

Definition at line 486 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [27/49]

BOOST_AUTO_TEST_CASE ( testInt32_fractionMinus12  )

Definition at line 401 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [28/49]

BOOST_AUTO_TEST_CASE ( testInt32ToInt16  )

Definition at line 1436 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [29/49]

BOOST_AUTO_TEST_CASE ( testInt32ToInt32  )

Definition at line 1414 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [30/49]

BOOST_AUTO_TEST_CASE ( testInt8  )

Definition at line 312 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [31/49]

BOOST_AUTO_TEST_CASE ( testIntSignedToUnsigned  )

Definition at line 1488 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [32/49]

BOOST_AUTO_TEST_CASE ( testUInt16  )

Definition at line 268 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [33/49]

BOOST_AUTO_TEST_CASE ( testUInt16_fractionMinus1  )

Definition at line 600 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [34/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction0  )

Definition at line 1160 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [35/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction17  )

Definition at line 1285 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [36/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction18  )

Definition at line 1334 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [37/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction43  )

Definition at line 1380 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [38/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fraction7  )

Definition at line 1226 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [39/49]

BOOST_AUTO_TEST_CASE ( testUInt18_fractionMinus12  )

Definition at line 1084 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [40/49]

BOOST_AUTO_TEST_CASE ( testUInt32  )

Definition at line 174 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [41/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction1  )

Definition at line 677 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [42/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction31  )

Definition at line 847 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [43/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction32  )

Definition at line 933 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [44/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction43  )

Definition at line 1014 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [45/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fraction7  )

Definition at line 766 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [46/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fractionMinus1  )

Definition at line 527 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [47/49]

BOOST_AUTO_TEST_CASE ( testUInt32_fractionMinus12  )

Definition at line 444 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [48/49]

BOOST_AUTO_TEST_CASE ( testUInt8  )

Definition at line 357 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [49/49]

BOOST_AUTO_TEST_CASE ( testVoid  )

Definition at line 1623 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ checkToCooked()

template<typename T >
void checkToCooked ( FixedPointConverter const &  converter,
uint32_t  input,
expectedValue 
)

Definition at line 81 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkToCookedOverflowNeg()

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

Definition at line 71 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ checkToCookedOverflowPos()

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

Definition at line 76 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:

◆ checkToRaw()

template<typename T >
void checkToRaw ( FixedPointConverter const &  converter,
input,
uint32_t  expectedValue 
)

Definition at line 96 of file testFixedPointConverter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ typeName()

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

Definition at line 49 of file testFixedPointConverter.cpp.

+ Here is the caller graph for this function: