On 3/10/09, Anselm R Garbe <garbeam_AT_gmail.com> wrote:
> 2009/3/10 Richard Pöttler <richard.poettler_AT_gmail.com>:
>> I just wanted to ask you guys if you could recommend me a tool to
>> unit test my C code. So far I only found CUnit, Check and CuTest but
>> haven't dug into any of them. Do you have any suggestions?
>
> #include <assert.h>
>
i see two immediate problems with assert:
1) one may want a message per failed test (to have a list) instead of abort
2) eg. equality checks are very common, but with assert
assert(x == y && "important eq check")
the values of x,y are not shown in case of failure (which are
important for understanding what went wrong)
one can easily define helper macros like
print_assert(condition)
eq_assert(x, y, message)
...
i'm not sure whether it is convenient to use or not.
unfortunately there are many special cases, like the eq_assert, when
it is possible to print useful additional messages without repetitive
printfs and
most test "frameworks" exploit these situations to provide a more
complete tool, but they are difficult to use in my experience.
Received on Tue Mar 10 2009 - 09:29:54 UTC
This archive was generated by hypermail 2.2.0 : Tue Mar 10 2009 - 09:36:06 UTC