From ff7418af730b02d963ff15a660f60811b2c2577a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 19 Sep 2018 12:57:33 +0100 Subject: [PATCH] tree234.c: minor fixes to the test suite. Added a missing #include of string.h; arranged that the test program reports the number of errors detected at the end so I don't have to search its entire output for "ERROR"; made the test program return a nonzero exit status if any error was found. --- tree234.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tree234.c b/tree234.c index d3c5293d..6c826309 100644 --- a/tree234.c +++ b/tree234.c @@ -1014,6 +1014,9 @@ void *del234(tree234 * t, void *e) */ #include +#include + +int n_errors = 0; /* * Error reporting function. @@ -1026,6 +1029,7 @@ void error(char *fmt, ...) vfprintf(stdout, fmt, ap); va_end(ap); printf("\n"); + n_errors++; } /* The array representation of the data. */ @@ -1480,7 +1484,8 @@ int main(void) delpostest(j); } - return 0; + printf("%d errors found\n", n_errors); + return (n_errors != 0); } #endif