-
Notifications
You must be signed in to change notification settings - Fork 34
assertEqual does not support nullptr #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yup, this seems like part of C++11 that needs to be added to the mocks. What's the data type of |
I will add |
Those updates still do not fix the issue with unittest(nullpointer_equal)
{
int* myPointer = NULL;
int **notNullPointer = &myPointer;
assertEqual(nullptr, myPointer);
assertNotEqual(nullptr, notNullPointer);
#if 0
// The following should not compile, which they currently do not but in a
// cryptic way. If possible and with low effort an explicit denial which
// produces an explanatory error would be nice.
assertLessOrEqual(nullptr, myPointer);
assertMoreOrEqual(nullptr, notNullPointer);
assertLess(nullptr, myPointer);
assertMore(nullptr, notNullPointer);
assertFalse(nullptr);
assertTrue(nullptr);
assertAnyLhsRhsFunction(..., nullptr);
#endif
} |
Thanks, those unit tests are exactly what was needed. |
@hlovdal You gave me an excellent idea here. I've set up a new branch called |
This fix is live in the latest version, sorry for the arbitrary delay there |
Trying to test that a function returns a null pointer, e.g.
does not work
I tried to fix it by extracting that line into a template function and then make a template specialisation for nullptr but did not get the compiler to select it, and have put that on ice for now since there is a simple workaround, just adding
at the top of the test file. But it would be nice to eventually have this fixed.
The text was updated successfully, but these errors were encountered: