simple libc tests
based on the libc-testsuit and libc-bench of dalias
see http://git.etalabs.net/cgi-bin/gitweb.cgi
build tests:
cp dist/config.mak .
# edit config.mak
make
run tests:
make
run benchmarks:
make b
framework:
the only hook in the test framework is error(...) which
prints a formatted message and sets the test to failed
see common/test.h
a test function looks like
void test_foo() {
if (foo != 42)
error("foo=%d expected 42\n", foo);
}
extern functions with name ~ /^test/ are recognized to be
test functions
a benchmark function looks like
void bench_foo(int N) {
for (i = 0; i < N; i++)
foo();
}
benchmark functions are repeatedly called with an increasing
N until the running time is long enough, then time/N is printed
see Makefile.inc for build system details
see common/t.c for test details
see common/b.c for benchmark details