Re: Poor man unit testing



On 07/22/10 08:34 PM, Andrea Crotti wrote:
Hi all, I work on a small but still complex C program, and we would like
to have some automatic unit testing setup.

At the moment we have in many C files an
--8<---------------cut here---------------start------------->8---
#ifdef STANDALONE
main()
.... with asserts

#endif
--8<---------------cut here---------------end--------------->8---

and then we compile accordingly from the Makefile for the testing.

This is of course not so great.

I would like something automatic that
1. if there is a STANDALONE compile it and run it
2. put an entry test in the Makefile and make the others depending on it

The problem is that the include path is quite complex and there are many
flags (not to mention other object files that depend on them).

I've seen also many unit test frameworks but actually they're too
complex for us at the moment..
Thanks for any hints,

Bite the bullet!

Even though it is a C++ frame work, googletest is very easy to get up and running.

--
Ian Collins
.