Can C++ preprocessor stringification produce a hexadecimal format?
I'm using Google Test to assert that certain error codes occur, and these
are always hex constants. So this output is less than ideal:
mytest.cpp line 130 and its output:
EXPECT_EQ(0xBFFF0011, error) << "Expected second close to return an error";
[ RUN ] MyTest.CloseSessionFail
mytest.cpp(130): error: Value of: error
Actual: -1074130544
Expected: 0xBFFF0011
Which is: 3221159953
Expected second close to return an error
In EXPECT_EQ(expected, actual), Google Test relies on the preprocessor to
stringify my error variable as "#actual". Is there some way to cause the
preprocessor to format hexadecimal output?
Ideally I'd like to see this:
Actual: 0xBFFA1190
Expected: 0xBFFF0011
No comments:
Post a Comment