c++ - How to use cppunit assert macros to check against preprocessor value which returns data type? -


i have list of preprocessor directives :

#define __size_type__ long unsigned int #define __uint16_type__ short unsigned int #define __uint_least8_type__ unsigned char #define __version__ 4 . . 

now writing cppunit test case checks these directives value follows:

cppunit_assert_equal(4, __version__); 

now want write same cppunit asserts uint16_type , size_type , uint_least8_type in order make sure have right value or not not getting cppunit assertion shall use? so, please suggest cppunit assert use purpose?

if you're using c++11, use std::is_same check types. http://en.cppreference.com/w/cpp/types/is_same

for example: cppunit_assert(std::is_same<size_type, long unsigned int>::value)

but honestly, don't see rationale in such checks.


Comments