[ntp-GSoC] Unity: agreeing to some convention, code review
Mark Vander Voord
mvandervoord at gmail.com
Mon Jun 29 13:36:42 UTC 2015
> >> 1. Helper functions in Unity
> That's a really great idea, something similar to what Damir Tomić came up
> with, but you took it to the next level. It looks very useful, but I have
> one concern:
> Usually software is divided into the interface and the internals. In C, we
> can't really force anyone not to use the internals. I am a little bit
> afraid of using them, because usually they aren't said to be backward
> compatible. NTP is a very long-term project and if a new version of Unity
> comes out, we will want to use it. Do you really think it's okay if we use
> stuff from unity_internals.h?
> We could just convert the line number from integer to string and use it
> with regular TEST_ASSERT_XXX_MESSAGE. I would really feel safer doing this,
> but maybe there's no point in doing that at all.
> Your solution here would also work, but I don't feel like it is necessary.
I completely understand your concern about trying to stick to the public
interface. In general, I would agree with that sentiment. Maybe I feel more
comfortable waiving those concerns in this case because I have been the
primary maintainer of Unity for awhile, so I feel like it mostly follows my
I certainly will not be offended if you choose to go with the string route.
I CAN say that CMock relies on the the UNITY_TEST_ASSERT_* macros already,
so I believe they are there to stay. :)
> >> 2. Which compare function to use?
> That's a very good idea - I'll use the HEX version whenever the byte
> boundaries may be important.
> By the way, there's always UNITY_TEST_ASSERT_EQUAL_HEX64, which is more
> than 32 bits.
> You're right. Always having HEX64 available may be an assumption you can
make for your application. Unity is often used on small embedded
processors, where sometimes a long long is only 32 bits. This is the reason
that the plain _HEX assertion is 32 instead of 64.
I don't know that your tools are ever used on targets that small, though,
so you might be able to get away with it?
> Sorry for the previous mail on the mailing list, I think that I finally
> figured it all out how to use it properly.
I'm not sure which email you are referring to, but I am confident that an
apology isn't necessary. Any challenges you might encounter when getting
Unity/etc up and running are worth trying to improve upon. I'm not going to
be offended if you pointed some issues out or something like that. :)
More information about the GSoC