[gcalctool] Hide passed tests when running unit tests



commit 39cfad21fc4a2906bc0f9ee1c9fa34d4b498cbe8
Author: Robin Sonefors <ozamosi flukkost nu>
Date:   Sat Jan 15 17:08:15 2011 +0100

    Hide passed tests when running unit tests
    
    It's really hard to see if anything failed otherwise.

 src/unittest.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/unittest.c b/src/unittest.c
index 40704dc..4880c2f 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
+#include <locale.h>
 
 #include "unittest.h"
 #include "mp-equation.h"
@@ -28,6 +29,7 @@
 static MPEquationOptions options;
 
 static int fails = 0;
+static int passes = 0;
 
 /* If we're not using GNU C, elide __attribute__ */
 #ifndef __GNUC__
@@ -37,15 +39,18 @@ static int fails = 0;
 static void pass(const char *format, ...) __attribute__((format(printf, 1, 2)));
 static void fail(const char *format, ...) __attribute__((format(printf, 1, 2)));
 
+
 static void pass(const char *format, ...)
 {
-    va_list args;
+/*    va_list args;
 
     printf(" PASS: ");
     va_start(args, format);
     vprintf(format, args);
     va_end(args);
     printf("\n");
+*/
+    passes += 1;
 }
 
 static void fail(const char *format, ...)
@@ -762,10 +767,13 @@ test_mp()
 
 void
 unittest()
-{    
+{
+    setlocale(LC_ALL, "C");
     test_mp();
     test_numbers();
     test_conversions();
     test_equations();
+    if (fails == 0)
+        printf("Passed all %i tests\n", passes);
     exit(fails > 0 ? 1 : 0);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]