I'm using catch2 (latest release - 2.13.6 as of this moment), and in my testcases I have a bunch of checks similar to the following:
CHECK(!strcmp(my_str, "some literal string here"));
where the literal is different for each testcase and obviously so is my_str
's contents.
When such a check fails, what I get on the output is the following:
/path/to/test_source_file.cpp:123: FAILED:
CHECK( !strcmp(my_str, "some literal string here") )
with expansion:
false
but I don't get the stirng within my_str
printed out. What's the best way to get the above to print (some of) the contents of my_str
as well?
Notes:
- You may not assume
my_str
is null-terminated. - Code must relatively succinct.
- I would rather not convert anything to an
std::string
, but if you must do that, I'm not ruling it out.