Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can googletest stringification produce a hexadecimal format?

Tags:

c++

googletest

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

For EXPECT_EQ(expected, actual), is there some way to cause it to format hexadecimal output?

Ideally I'd like to see this:

  Actual: 0xBFFA1190
Expected: 0xBFFF0011
like image 729
Erik Olson Avatar asked Feb 04 '26 16:02

Erik Olson


1 Answers

Probably this message will help you: https://github.com/google/googletest/issues/222

like image 171
Andrey Epifantsev Avatar answered Feb 06 '26 06:02

Andrey Epifantsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!