I use CPPUNIT_ASSERT_EQUAL(a, b) to check the value a and b. The a and b are unsigned char type. So, when this assertion failed it will display the expected and actual value. Because the type is unsigned char, the expected and actual value will be displayed as characters. For example, 35 will be displayed as #. But this is not what I want. Of course, CPPUNIT_ASSERT_EQUAL((int)a, (int)b) may be a solution but it looks like strange. In addition, it would be better if the values are displayed as hex format. But I don’t know how to reach this. It would be highly appreciated if somebody gives a answer.
Share
I’d think the only way to achieve this effect is to adapt
aand/orbwith a suitable type which does the required comparison but is formatted differently thanunsigned char. This could look something like this:Obviously, the type to adapt the values is just needed to be defined once in a suitable place and can go into a suitable macro. I don’t know CPPUNIT but I could image that something like this exists somewhere.