Comments (3)
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.
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.
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)
- Create a Conan recipe for Unity Test HOT 1
- using Stim command in sim_instruction.txt for unit testing (simulator) with xc8 project HOT 1
- Unit Testing with unity using ceedling on Tarhet Hardware. Programming Target Failed
- mb HOT 2
- cmake and unity_config.h HOT 14
- Issue with Discovery of Included Mocks In Test Runner Generator HOT 4
- TEST_PRINTF() expansion error when no variadic arguments are passed
- TEST_PRINTF(): printing 64-bit hex numbers or pointers HOT 1
- Release for floats and doubles testing HOT 2
- README description of INT assertions is structured oddly
- How do I reset state of static variables inside functions called by multiple tests? HOT 3
- Fails to compile with latest XC8
- static variable inside of target function is reset everytime when it is invoked HOT 3
- Add __FILE__ to failure messages. HOT 1
- Intent of verbosity and command line parsing? HOT 6
- No mention about instructions to build from source and support_double option HOT 5
- mistakenly opened issue
- closed HOT 1
- Issue with comparing the streams. HOT 2
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.