79772984

Date: 2025-09-23 19:09:30
Score: 1
Natty:
Report link

The preferred way to check types with Google Test is:

std::any x = 73;
EXPECT_EQ(x.type(), typeid(double));

With recent versions of Google Test this gives a readable output like this:

Expected equality of these values:
  x.type()
    Which is: char
  typeid(double)
    Which is: double

With older versions (like 1.11) that still works properly, but only the output is not as readable.

Thanks a lot to Marek R and all the others who provided valuable input.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Jens