Skip to content
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

ASSERT_EQUAL should not assume integer #53

Open
digitalentity opened this issue Apr 1, 2023 · 1 comment
Open

ASSERT_EQUAL should not assume integer #53

digitalentity opened this issue Apr 1, 2023 · 1 comment

Comments

@digitalentity
Copy link

In certain test-cases it's necessary to test for an exact float-point value. ASSERT_EQUAL is not suitable for this because it assumes arguments to be integers. ASSERT_FLT_NEAR is not suitable either, because it will accept not equal values.

The workaround I currently use is ASSERT_TRUE(function_under_test() == 1.0f), which works as expected, but is not as readable as ASSERT_EQUAL(function_under_test(), 1.0f).

@bvdberg
Copy link
Owner

bvdberg commented Apr 3, 2023

How do you propose to implement this? The same ASSERT_EQUAL macro cannot be used, since the function behind it needs to print either 2 floats or 2 integers..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants