From a798f84bf505557c3cc6648ff91cdfe086473678 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 4 Aug 2008 22:15:43 +0200 Subject: [PATCH] Add simple test report to unittesting. --- src/util-unittest.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/util-unittest.c b/src/util-unittest.c index bc55a44258..3f9dd7c34c 100644 --- a/src/util-unittest.c +++ b/src/util-unittest.c @@ -50,15 +50,25 @@ void UtRegisterTest(char *name, int(*testfn)(void), int evalue) { int UtRunTests(void) { UtTest *ut; int result = 0; + u_int32_t good = 0, bad = 0; for (ut = ut_list; ut != NULL; ut = ut->next) { printf("Test %-60s : ", ut->name); fflush(stdout); /* flush so in case of a segv we see the testname */ int ret = ut->testfn(); printf("%s\n", (ret == ut->evalue) ? "pass" : "FAILED"); - if (ret != ut->evalue) result = 1; + if (ret != ut->evalue) { + result = 1; + bad++; + } else { + good++; + } } + printf("==== TEST RESULTS ====\n"); + printf("PASSED: %u\n", good); + printf("FAILED: %u\n", bad); + printf("======================\n"); return result; }