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

Add support for <= and >= for Approx #715

Merged
merged 1 commit into from
Jan 8, 2017

Conversation

jbcoe
Copy link
Contributor

@jbcoe jbcoe commented Sep 24, 2016

closes #651

@jbcoe
Copy link
Contributor Author

jbcoe commented Sep 26, 2016

failing tests are unconnected with this change and addressed by #716

@horenmar horenmar added the Tweak label Jan 7, 2017
@horenmar horenmar merged commit 37e1e24 into catchorg:master Jan 8, 2017
@onqtam
Copy link

onqtam commented Feb 25, 2017

looking at this PR - isn't it possible to also implement less-than and greater-than - like this:

friend bool operator< (double lhs, Approx const& rhs) { return lhs < rhs.m_value && lhs != rhs; }
friend bool operator< (Approx const& lhs, double rhs) { return lhs.m_value < rhs && lhs != rhs; }
friend bool operator> (double lhs, Approx const& rhs) { return lhs > rhs.m_value && lhs != rhs; }
friend bool operator> (Approx const& lhs, double rhs) { return lhs.m_value > rhs && lhs != rhs; }

by using && and not-equals instead of equals?

@jbcoe
Copy link
Contributor Author

jbcoe commented Mar 29, 2017

@onqtam I think you are right. I'm not sure I'd find <, > useful for Approx. Do you have a use-case in mind?

@onqtam
Copy link

onqtam commented Mar 29, 2017

not really - but just for completeness' sake

@jbcoe
Copy link
Contributor Author

jbcoe commented Mar 29, 2017

REQUIRE(x < Approx(2.3));

seems a bit odd to me. I'd be reluctant to add your functions for completeness' sake without a motivating use case.

@horenmar
Copy link
Member

I am against adding those.

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

Successfully merging this pull request may close these issues.

Add support for <=, >= to Approx
3 participants