CHECK with message doesn't work
GibbOne opened this issue · 9 comments
First of all I'd like to thank @jasmcaus for this useful library.
So, I found out a little problem with custom failure message.
According to documentation it's enough to add a further parameter. But If I add a parameter, the check never fails.
Below an example.
TEST(TAU, ItShouldFailWithMessage)
{
CHECK(0); // this check fails correctly.
CHECK(0, "It should FAIL"); // this check doesn't fail.
}
Am i missing something?
@GibbOne I ran this locally, and it seems to work:
Try this in a test file:
#include <tau/tau.h>
TAU_MAIN()
TEST(TAU, ItShouldFailWithMessage)
{
CHECK(0); // this check fails correctly.
CHECK(0, "It should FAIL"); // this check doesn't fail.
}
Let me spin up Windows in a WM to see, if I can reproduce.
// file t1.c
#include <tau/tau.h>
TAU_MAIN()
TEST(TAU, ItShouldFailWithMessage)
{
CHECK(0); // this check fails correctly.
//CHECK(0, "It should FAIL"); // this check doesn't fail.
}
// file t2.c
#include <tau/tau.h>
TAU_MAIN()
TEST(TAU, ItShouldFailWithMessage)
{
//CHECK(0); // this check fails correctly.
CHECK(0, "It should FAIL"); // this check doesn't fail.
}
// windows cmds:
// cl /I . t1.c -o t1
// cl /I . t2.c -o t2
// linux (works)
// gcc -I . test.c -o t1 && ./t1
// gcc -I . test.c -o t2 && ./t2
@GibbOne Please always provide version numbers for the compiler version.
On the latest? release 19.13.31105 I get with cl /I tau t1.c
with t1.c having the following content:
// file t1.c
#include <tau/tau.h>
TAU_MAIN()
TEST(TAU, ItShouldFailWithMessage)
{
CHECK(0); // this check fails correctly.
//CHECK(0, "It should FAIL"); // this check doesn't fail.
}
the following error:
tau\tau/misc.h(34): fatal error C1083: Cannot open include fils: 'inttypes.h': No such file or directory.
So to me it looks like tau is broken on MSVC.
@matu3ba I already showed MSVC compiler version on my last post. Look at picture of console.
@GibbOne My bad.
At least this post indicates that Microsoft only guarantees compatibility via their libraries.
https://stackoverflow.com/questions/41975672/abi-compatibility-of-visual-studio-c-libraries
A proper fix would probably require https://stackoverflow.com/questions/9233118/library-abi-compatibility-between-versions-of-visual-studio with https://github.com/lvc/abi-compliance-checker to figure out what is broken,
since unfortunately Microsoft does not generate reports what stuff they broke how and when.
I solved by adding /Zc:preprocessor
compiler option.
See https://stackoverflow.com/a/5134656/6539880 and https://docs.microsoft.com/en-us/cpp/build/reference/zc-preprocessor?view=msvc-170.