From 3465d5553fbe88a75320d1da3f7228619492b036 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 28 Sep 2014 05:56:13 +0200 Subject: Make the tests work again Our UTF-8 parsing now behaves differently, though. --- t/taplib.c | 84 +++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 37 deletions(-) (limited to 't/taplib.c') diff --git a/t/taplib.c b/t/taplib.c index f9e7425..bfb70f8 100644 --- a/t/taplib.c +++ b/t/taplib.c @@ -4,66 +4,76 @@ #include #include -static int nexttest = 1; -static int _exit_status = 0; +static int g_nexttest = 1; +static int g_exit_status = 0; -void plan_tests(int n) +void +plan_tests (int n) { - printf("1..%d\n", n); + printf ("1..%d\n", n); } -void pass(char *name) +void +pass (char *name) { - printf("ok %d - %s\n", nexttest++, name); + printf ("ok %d - %s\n", g_nexttest++, name); } -void fail(char *name) +void +fail (char *name) { - printf("not ok %d - %s\n", nexttest++, name); - _exit_status = 1; + printf ("not ok %d - %s\n", g_nexttest++, name); + g_exit_status = 1; } -void ok(int cmp, char *name) +void +ok (int cmp, char *name) { - if(cmp) - pass(name); - else - fail(name); + if (cmp) + pass (name); + else + fail (name); } -void diag(char *fmt, ...) +void +diag (char *fmt, ...) { - va_list args; - va_start(args, fmt); + va_list args; + va_start (args, fmt); - fprintf(stderr, "# "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); + fprintf (stderr, "# "); + vfprintf (stderr, fmt, args); + fprintf (stderr, "\n"); - va_end(args); + va_end (args); } -void is_int(int got, int expect, char *name) +void +is_int (int got, int expect, char *name) { - if(got == expect) - ok(1, name); - else { - ok(0, name); - diag("got %d expected %d", got, expect); - } + if (got == expect) + ok (1, name); + else + { + ok (0, name); + diag ("got %d expected %d", got, expect); + } } -void is_str(const char *got, const char *expect, char *name) +void +is_str (const char *got, const char *expect, char *name) { - if(strcmp(got, expect) == 0) - ok(1, name); - else { - ok(0, name); - diag("got '%s' expected '%s'", got, expect); - } + if (strcmp (got, expect) == 0) + ok (1, name); + else + { + ok (0, name); + diag ("got '%s' expected '%s'", got, expect); + } } -int exit_status(void) +int +exit_status(void) { - return _exit_status; + return g_exit_status; } -- cgit v1.2.3-54-g00ecf