mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-29 22:08:45 +08:00
Improved display of CHECK_EQUAL_HEX in unittest++
This commit is contained in:
parent
dd0cf816f6
commit
c3603c4d7e
@ -190,7 +190,9 @@ namespace UnitTest
|
||||
if (!(expected == actual))
|
||||
{
|
||||
UnitTest::MemoryOutStream stream;
|
||||
stream << std::hex << std::uppercase << std::setfill('0') << "Expected 0x" << std::setw(2 * sizeof(Expected)) << expected << " but was 0x" << std::setw(2 * sizeof(Actual)) << actual;
|
||||
stream << std::hex << std::uppercase << std::setfill('0')
|
||||
<< "Expected 0x" << std::setw(2 * sizeof(Expected)) << (expected & ~(typename std::make_unsigned<Expected>::type(0)))
|
||||
<< " but was 0x" << std::setw(2 * sizeof(Actual)) << (actual & ~(typename std::make_unsigned<Actual>::type(0)));
|
||||
|
||||
results.OnTestFailure(details, stream.GetText());
|
||||
}
|
||||
@ -214,7 +216,8 @@ namespace UnitTest
|
||||
if (expected == actual)
|
||||
{
|
||||
UnitTest::MemoryOutStream stream;
|
||||
stream << std::hex << std::uppercase << std::setfill('0') << std::setw(2 * sizeof(Actual)) << "Expected not equal, but both values are " << actual;
|
||||
stream << std::hex << std::uppercase << std::setfill('0') << std::setw(2 * sizeof(Actual))
|
||||
<< "Expected not equal, but both values are " << (actual & ~(typename std::make_unsigned<Actual>::type(0)));
|
||||
|
||||
results.OnTestFailure(details, stream.GetText());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user