mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Add a basic test framework.
This commit is contained in:
1 parent
ca9fba83c5
commit
9724466233
2 files changed
+44
-6
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
char fail_msg[65536] = {0};
|
||||
|
||||
#define FAIL(...) snprintf(fail_msg, sizeof fail_msg, ##__VA_ARGS__)
|
||||
|
||||
int tests_run = 0;
|
||||
|
||||
typedef void (*test)();
|
||||
|
||||
test tests[];
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
for (test* t = tests; *t; t++) {
|
||||
(*t)();
|
||||
if (fail_msg[0]) {
|
||||
printf("FAIL %s\n", fail_msg);
|
||||
return 1;
|
||||
}
|
||||
tests_run++;
|
||||
}
|
||||
printf("PASS (%d tests run)\n", tests_run);
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user