Comments (3)
Interesting.
I admit that I'm a little puzzled by this.
As I was reading through your example, I was pretty sure that the problem was going to be that your typedef was not in an #include that was visible to the function under test or something like that... but I'm not sure that makes sense now that I have read it all.
I suspect it has something to do with the size of the enum. Clearly, a long long int is much bigger than your enum needs to be. Depending on the gcc target, that enum might be a byte or it might be an int (I think those are the most common). Either way, you're getting a mismatch in the size you are comparing vs the size you are passing.
It still seems like it should handle this without complaint for you, but breaking the casts into two steps by giving it a temporary variable seems to make it happier.
Out of curiosity, have you tried using a specific int size instead of the general assertion?
TEST_ASSERT_EQUAL_HEX8 or TEST_ASSERT_EQUAL_HEX32 maybe?
Mark
from unity.
Hi Mark,
yeah I've tried to use the TEST_ASSERT_EQUAL_HEX8 and the TEST_ASSERT_EQUAL_HEX32, but is won't help. I've checked size of the plain integer on my platform as well as size of enum. It seems that those both sizes are equal 4. Right now I don't get it why gcc rises warning for such a construction, and I'd like to investigate this further. Please let me know do you have any idea why is it not working.
from unity.
Wow. I forgot to come back to this one. I apologize if anyone was actually waiting on a good response here.
Giving it some thought, to those who might run into this in the future, I suspect it's that there wasn't a declaration for the function anywhere in the test (or in a header the test included). If it had been added, like so:
extern TEST_error_t TEST_fnc(void);
I bet the error would have gone away. I suspect the problem was that without the function declaration being there, gcc assumed the return value was the biggest int it could... which then didn't fit into the ASSERT.
from unity.
Related Issues (20)
- Add __FILE__ to failure messages. HOT 1
- Intent of verbosity and command line parsing? HOT 6
- Bug: Boolean is found to be both true and false simultaneously HOT 3
- 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
- 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.
- 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
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.