test.c: Improved test infrastructure.