Comments (8)
I'd be happy to look into a fix for this. However we'd need some agreement on what the behaviour should be. I'd suggest the following:
TEST_ASSERT_EQUAL_FLOAT(123.4f, Inf) Fails
TEST_ASSERT_EQUAL_FLOAT(Inf, 123.4f) Fails
TEST_ASSERT_EQUAL_FLOAT(Inf,Inf) Passes
TEST_ASSERT_EQUAL_FLOAT(Inf,-Inf) Fails
TEST_ASSERT_EQUAL_FLOAT(Inf,NaN) fails
TEST_ASSERT_EQUAL_FLOAT(NaN,Inf) fails
I'm not sure what we should do here though:
TEST_ASSERT_EQUAL_FLOAT(NaN1,NaN1)?
TEST_ASSERT_EQUAL_FLOAT(NaN1,NaN2)?
from unity.
I think I'd personally prefer to have all Inf / -Inf / NaN comparisons fail in TEST_ASSERT_EQUAL_FLOAT, and have a TEST_ASSERT_IS_INF, TEST_ASSERT_IS_NEG_INF, and TEST_ASSERT_IS_NAN. It seems cleaner, especially since there's rarely a supported standard notation for any of those values.
from unity.
I tend to agree with Mark here.
On Tue, Oct 30, 2012 at 10:39 AM, Mark VanderVoord <[email protected]
wrote:
I think I'd personally prefer to have all Inf / -Inf / NaN comparisons
fail in TEST_ASSERT_EQUAL_FLOAT, and have a TEST_ASSERT_IS_INF,
TEST_ASSERT_IS_NEG_INF, and TEST_ASSERT_IS_NAN. It seems cleaner,
especially since there's rarely a supported standard notation for any of
those values.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-9907916.
from unity.
The only think I might disagree with is TEST_ASSERT_EQUAL(Inf,Inf). MY reasoning is that TEST_ASSERT_TRUE(Inf==Inf) would pass. Also, if someone has passed infinity as an expected value they probably want it to pass if the actual value is infinity. However I'm perfectly happy to implement either way.
As an aside I'm guessing we don't want to introduce a dependancy on math.h? That shouldn't be a problem though.
from unity.
What about the array versions? Should they also fail for any special values? We probably want consistent behaviour with the non-array versions.
Is there a need for the likes of TEST_ASSERT_FLOAT_ARRAY_IS_INF?
from unity.
The array versions should fail for the same things that the non-array versions do, for sure.
I'm feeling like an array check for IS_INF or IS_NAN is overkill.
from unity.
If someone really wants to check for an array of NaNs they can always roll their own loop.
I've changed the array versions so they have the same behaviour.
from unity.
do you have its webplaer to test ?
from unity.
Related Issues (20)
- Possibly typo in test_unity_integers_64.c and test_unity_arrays.c HOT 1
- Avoid running the setup for some specific tests HOT 3
- #529 still unfixed after merge HOT 2
- PlatformIO failing to parse manifest on install. HOT 1
- Game thing.com HOT 1
- How do I rename the `setUp` and `tearDown` functions? HOT 2
- Build fails with -Werror=missing-declarations when UNITY_USE_COMMAND_LINE_ARGS is enabled HOT 1
- XML/JSON based report generating? HOT 2
- Errr how u use this HOT 1
- Can you code on iPad using this app?
- I'm in secondary school first grade sooo i have no idea what I'm doing (I'm trying to tell but not expose my age) HOT 1
- Can you use this app to code on iPad?
- ssize_t asserts are missing
- Add Example for Testing using CMake
- Build fails when not using UNITY_USE_COMMAND_LINE_ARGS
- Feature Request: Support asymmetric range assertions HOT 2
- Some codes failed `-Werror=float-equal` compiler flag, please fix it.
- UNITY_NORETURN redefines noreturn, uses stdnoreturn.h which can break compatibility with C23 and is being defined when unnecessary HOT 1
- Generic assertion HOT 3
- Invalid file name reported HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity.