[PATCH 0/3] Resubmit - Unit test framework for Wayland
Daniel Stone
daniel at fooishbar.org
Fri Mar 2 14:28:49 PST 2012
Hi,
On 2 March 2012 21:53, Andreas Ericsson <ae at op5.se> wrote:
> I've written a few in my days. Normally, I keep them ridiculously
> simple, so the testing code looks something like this (sorry for the
> sucky indentation; coding in a mua is always crap):
>
> some_test_func(args)
> {
> test_suite t;
> int x, y;
>
> x = 5;
> y = x;
> test(&t, x == y, "x(%d) and y(%d) should be equal", x, y);
> stest(&t, x == y); /* would print "fail: x == y evaluated as FALSE" */
> end_tests(&t); /* would print "OK: %d/%d tests passed */
> }
Maybe it's just a poor example, but something like this:
some_test_func(args)
{
int x = 5;
int y = 5;
printf("checking if C compiler isn't thoroughly broken ... ");
assert(x == y);
printf("success\n");
}
would seem to work just as well.
I can almost see the argument for something slightly more
comprehensive though, since rendercheck-style results of being able to
compare various runs in their entirety rather than bailing out on the
first failure, are more useful. But still ...
Cheers,
Daniel
More information about the wayland-devel
mailing list