Giter VIP home page Giter VIP logo

Comments (3)

jensenr30 avatar jensenr30 commented on June 9, 2024

Perhaps this bug could be fixed by defining TEST_ASSERT_TRUE in terms of TEST_ASSERT_FALSE so there can never be a discrepancy between the two? Or have them both use a common method of determining if a boolean is true or false.

E.g.

#define is_false(b) (b == 0)
#define TEST_ASSERT_FALSE(b) assert(is_false(b))
#define TEST_ASSERT_TRUE(b) assert(!is_false(b))

from unity.

jensenr30 avatar jensenr30 commented on June 9, 2024

It looks like this is not a bug with Unity per se.

I tried running this code in the same project:

    // ...
    bool boolean;
    memset(&boolean, 90, sizeof(boolean));
    if (boolean == true) {
        printf("boolean is true\n");
    }
    if (boolean == false) {
        printf("boolean is false\n");
    }
    if (boolean == 1) {
        printf("boolean is 1\n");
    }
    if (boolean == 0) {
        printf("boolean is 0\n");
    }
    // ...

And the output is:

boolean is true
boolean is false
boolean is 1
boolean is 0

from unity.

mvandervoord avatar mvandervoord commented on June 9, 2024

I can't reproduce the problem. Also, I suspect you're using an older Unity? The latest version has the following:

#define TEST_ASSERT_TRUE(condition)     UNITY_TEST_ASSERT(       (condition), __LINE__, " Expected TRUE Was FALSE")
#define TEST_ASSERT_FALSE(condition)    UNITY_TEST_ASSERT(      !(condition), __LINE__, " Expected FALSE Was TRUE")

As long as your compiler is working, I don't believe this could demonstrate the problem you're seeing.

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.