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

[FR]: Add EXPECT_DOUBLE_NE and ASSERT_DOUBLE_NE #4612

Open
Ryanf55 opened this issue Sep 13, 2024 · 1 comment
Open

[FR]: Add EXPECT_DOUBLE_NE and ASSERT_DOUBLE_NE #4612

Ryanf55 opened this issue Sep 13, 2024 · 1 comment

Comments

@Ryanf55
Copy link

Ryanf55 commented Sep 13, 2024

Does the feature exist in the most recent commit?

NOPE

Why do we need this feature?

Checking that two doubles are NOT equal is more difficult than it is to check they are equal per S.O.

One approach is to bring in gmock and link to it if you want to check a double value is not equal:

#include <gmock/gmock.h>
#include <gtest/gtest.h>

EXPECT_DOUBLE_EQ(another_value, 3.14);
EXPECT_THAT(another_value, testing::Not(testing::DoubleEq(3.14)));

Describe the proposal.

Here is what I would prefer for the API, which use "NE" like EXPECT_NE

EXPECT_DOUBLE_EQ(another_value, 3.14);
EXPECT_DOUBLE_NE(another_value, 3.14);

Same with

  • EXPECT_FLOAT_NE
  • ASSERT_DOUBLE_NE
  • ASSERT_FLOAT_NE

Is the feature specific to an operating system, compiler, or build system version?

It could be implemented on any OS.

@jordans6
Copy link

Hi! If this feature hasn't been taken by anyone yet I'd like to work on it!

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

No branches or pull requests

2 participants