You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
char* a = strdup("Hello");
char* b = strdup("Hello");
CHECK(a == b); // passes, even though it shouldn't
Looking at the code, it seems like 'eq' is transforming the value to a string, and then doing the comparison, which doesn't do the right thing in this particular case. Casting the pointers to void* seems to solve it.
The text was updated successfully, but these errors were encountered:
You're reporting this at the right time - just a day or 2 before the release of 1.1 - which is supposed to be stable - so thanks - you swayed me in the right direction.
More people would like the pointers to be compared instead of the C strings - and this is what I'll do - by default the pointers will be compared, and only if the user defines something like DOCTEST_CONFIG_COMPARE_C_STRINGS will they be treated differently.
I initially made it the way it is because boost.test does the same (I think). But I will change it for 1.1 - another little breaking change...
…fault - you will need to define the DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING identifier to enable this! This also affects stringification of char pointers. fixes#36
Looking at the code, it seems like 'eq' is transforming the value to a string, and then doing the comparison, which doesn't do the right thing in this particular case. Casting the pointers to void* seems to solve it.
The text was updated successfully, but these errors were encountered: