Giter Site home page Giter Site logo

Comments (3)

mvandervoord avatar mvandervoord commented on July 24, 2024

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.

lazureus avatar lazureus commented on July 24, 2024

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.

mvandervoord avatar mvandervoord commented on July 24, 2024

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)

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.