Giter Site home page Giter Site logo

Comments (8)

rryles avatar rryles commented on July 24, 2024

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.

mvandervoord avatar mvandervoord commented on July 24, 2024

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.

sw17ch avatar sw17ch commented on July 24, 2024

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.

rryles avatar rryles commented on July 24, 2024

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.

rryles avatar rryles commented on July 24, 2024

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.

mvandervoord avatar mvandervoord commented on July 24, 2024

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.

rryles avatar rryles commented on July 24, 2024

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.

unity3diy avatar unity3diy commented on July 24, 2024

do you have its webplaer to test ?

from unity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.