--- "Clayton, Nik" <[EMAIL PROTECTED]> wrote: 
> Having done the initial work to get most of FreeBSD's regression testing
> infrastructure producing Test::Harness TAP compatible output, I've started
> putting together a C library that makes it easier to write tests in C.

Great!
This is something I'm interested in and wish I had more spare time
to pursue. Here are a few random ideas.

1) You might be able to steal some implementation ideas from:

http://cutest.sourceforge.net/

This is a very simple C Unit Testing framework.
In particular, it keeps state in a CuTest struct which is passed
around as the first (mostly hidden) parameter to most functions.

2) A uniform mechanism for test programs to handle command line
arguments would be nice. For example:

int main(int argc, char* argv[])
{
    tap_init(argc, argv);  /* mythical new tap function */
    // ...
}

Some possible command line arguments are:
  -v verbose
  -d debug
  -t give timing information (via ANSI C clock() function, say)

3) Implementing cmp_ok() in C is a challenge. ;-)

xUnit/cutest have things like:

AssertStrEquals
AssertIntEquals
...

The trouble with plain old ok() is that investigating test failures
is a pest. I suppose you could support equals for the basic C types.
For example:

cmp_ok_int_equals
cmp_ok_double_equals
cmp_ok_cstr_equals
cmp_ok_mem_equals
...

and so on. In the cstr/mem case, you can have the function check
for NULL pointers and give a nice diagnostic rather than crashing.

4) Is thread-safety a requirement of your library?

If so, you better think about it now because it's very hard to
retrofit.

HTH,
/-\


Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

Reply via email to