X-Git-Url: https://pd.if.org/git/?p=lice;a=blobdiff_plain;f=testrun.c;fp=testrun.c;h=b6299a2b19f0267e41c15802bf3f6b201a1594a4;hp=0000000000000000000000000000000000000000;hb=686688990cde8ecd8d9423fde7f88b6ac6ac8a40;hpb=e8938573442eb3f5f550420ff3a0eb703730c1a3 diff --git a/testrun.c b/testrun.c new file mode 100644 index 0000000..b6299a2 --- /dev/null +++ b/testrun.c @@ -0,0 +1,60 @@ + +// some decls to suppress some warnings the compiler will emit +void exit(int); +int printf(const char *__format, ...); +int strcmp(const char *__s1, const char *__s2); +int vsprintf(char *__src, const char *__format, void *); +void *dlsym(void *__handle, const char *__symbol); +void *dlopen(const char *__library, long __flags); +int snprintf(char *__s, unsigned long __maxlen, const char *__format); + +int external_1 = 1337; +int external_2 = 7331; + +void expecti(int a, int b) { + if (a != b) { + printf(" Expected: %d\n", b); + printf(" Result: %d\n", a); + exit(1); + } +} + +void expectl(long a, long b) { + if (a != b) { + printf(" Expected: %d\n", b); + printf(" Result: %d\n", a); + exit(1); + } +} + +void expectf(float a, float b) { + if (a != b) { + printf(" Expected: %f\n", b); + printf(" Result: %f\n", a); + exit(1); + } +} + +void expectd(double a, double b) { + if (a != b) { + printf(" Expected: %f\n", b); + printf(" Result: %f\n", a); + exit(1); + } +} + +void expects(short a, short b) { + if (a != b) { + printf(" Expected: %s\n", b); + printf(" Result: %s\n", a); + exit(1); + } +} + +void expectstr(const char *a, const char *b) { + if (strcmp(a, b)) { + printf(" Expected: %s\n", b); + printf(" Result: %s\n", a); + exit(1); + } +}