Add macros for testing inequalities between floats, doubles by jonathangjertsen · Pull Request #560 · ThrowTheSwitch/Unity · GitHub
Skip to content

Add macros for testing inequalities between floats, doubles#560

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

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

Conversation

@jonathangjertsen

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

# Conflicts:
#	README.md
#	docs/UnityAssertionsReference.md
@jonathangjertsen

Copy link
Copy Markdown
Contributor Author

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

@mvandervoord

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@jonathangjertsen

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

@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