Skip to content

Add macros for testing inequalities between floats, doubles#560

Merged
mvandervoord merged 7 commits intoThrowTheSwitch:masterfrom
jonathangjertsen:more-float
May 25, 2022
Merged

Add macros for testing inequalities between floats, doubles#560
mvandervoord merged 7 commits intoThrowTheSwitch:masterfrom
jonathangjertsen:more-float

Conversation

@jonathangjertsen
Copy link
Contributor

Fixes issue #559
Also fixed some formatting errors in the assertions reference.

I did not do the <=/>= variants because I'm not sure what the API should be (TEST_ASSERT_LESS_OR_EQUAL_FLOAT(threshold, actual)? TEST_ASSERT_LESS_OR_WITHIN_FLOAT(threshold, delta, actual)?), and I can't think of a case where they would be useful.

@jonathangjertsen
Copy link
Contributor Author

Tests are passing in my fork where I've enabled workflows for the branch https://github.com/jonathangjertsen/Unity/runs/2656539535?check_suite_focus=true (there is another unrelated failure which is fixed by #557)

# Conflicts:
#	README.md
#	docs/UnityAssertionsReference.md
@jonathangjertsen
Copy link
Contributor Author

Any thoughts, @mvandervoord? I found myself wanting this feature again today.

@mvandervoord
Copy link
Member

People have been wanting this for awhile. Thanks for the hard work!

Do you have any interest in expanding this to support GREATER_THAN_OR_EQUAL (maybe just GE?) and LESS_THAN_OR_EQUAL and maybe NOT_EQUAL so we have a complete set of comparitors?

@jonathangjertsen
Copy link
Contributor Author

Sure, will do. I think it should be GREATER_THAN_OR_EQUAL rather than GE for consistency

@jonathangjertsen
Copy link
Contributor Author

Added:

TEST_ASSERT_NOT_WITHIN_FLOAT
TEST_ASSERT_NOT_EQUAL_FLOAT
TEST_ASSERT_LESS_OR_EQUAL_FLOAT
TEST_ASSERT_GREATER_OR_EQUAL_FLOAT
TEST_ASSERT_NOT_WITHIN_DOUBLE
TEST_ASSERT_NOT_EQUAL_DOUBLE
TEST_ASSERT_LESS_OR_EQUAL_DOUBLE
TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE

@jonathangjertsen
Copy link
Contributor Author

The CI pipeline is not running since it's awaiting approval by a maintainer - but it is passing in my fork: jonathangjertsen#2

@jonathangjertsen
Copy link
Contributor Author

Is there anything else required for this to be merged (or at least reviewed)?

@mvandervoord mvandervoord merged commit e54c978 into ThrowTheSwitch:master May 25, 2022
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

Successfully merging this pull request may close these issues.

2 participants