Re: [dwm] C unit testing

2009-03-11 Thread Richard Pöttler
On Tue, Mar 10, 2009 at 09:24:41AM +, A.S. Bradbury wrote:
 On Tue, Mar 10, 2009 at 8:48 AM, Richard Pöttler
 richard.poett...@gmail.com wrote:
  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?
 
 I haven't yet used it, but Google have released cmockery:
 
 http://code.google.com/p/cmockery/

Thanks. I will give it a try.

bye
richi
-- 
quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html


pgpyO5mkQ0Iwj.pgp
Description: PGP signature


[dwm] C unit testing

2009-03-10 Thread Richard Pöttler
Hi,

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?

bye
richi
-- 
quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html


pgp8k9YVvRA6B.pgp
Description: PGP signature


Re: [dwm] C unit testing

2009-03-10 Thread Anselm R Garbe
2009/3/10 Richard Pöttler richard.poett...@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

;)

Kind regards,
--Anselm



Re: [dwm] C unit testing

2009-03-10 Thread Szabolcs Nagy
On 3/10/09, Anselm R Garbe garb...@gmail.com wrote:
 2009/3/10 Richard Pöttler richard.poett...@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.



Re: [dwm] C unit testing

2009-03-10 Thread A.S. Bradbury
On Tue, Mar 10, 2009 at 8:48 AM, Richard Pöttler
richard.poett...@gmail.com wrote:
 Hi,

 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?

I haven't yet used it, but Google have released cmockery:

http://code.google.com/p/cmockery/

Alex