X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=tests%2Funit%2Fglkunit.c;fp=tests%2Funit%2Fglkunit.c;h=63d813489783400bef9bb146a42a4023e77922f8;hp=0000000000000000000000000000000000000000;hb=ad091d02678a632f0f91f26072bbec29eba4c66e;hpb=9b7445bd66c18e85b0d312f0c12a5050fe528073 diff --git a/tests/unit/glkunit.c b/tests/unit/glkunit.c new file mode 100644 index 0000000..63d8134 --- /dev/null +++ b/tests/unit/glkunit.c @@ -0,0 +1,28 @@ +#include +#include +#include "glk.h" +#include "glkunit.h" + +extern struct TestDescription tests[]; + +void +glk_main(void) +{ + struct TestDescription *test = tests; + int tested = 0, succeeded = 0, failed = 0; + while(test->name != NULL) { + tested++; + /* Use stdio.h to print to stdout, Glk can't do that */ + printf(" Testing %s... ", test->name); + if( test->testfunc() ) { + succeeded++; + printf("PASS\n"); + } else { + failed++; + printf("FAIL\n"); + } + test++; + } + printf("%d tests run, %d failures\n", tested, failed); + exit(failed > 0); +}