2006-08-18 Aaron Bockover <abockover@novell.com>
authorAaron Bockover <abockover@novell.com>
Fri, 18 Aug 2006 11:42:34 +0000 (11:42 -0000)
committerAaron Bockover <abockover@novell.com>
Fri, 18 Aug 2006 11:42:34 +0000 (11:42 -0000)
    * test/test.[ch]:
    * test/driver.c: Support pass/fail logging on tests to show group report

svn path=/trunk/mono/; revision=63985

eglib/ChangeLog
eglib/test/driver.c
eglib/test/test.c
eglib/test/test.h

index d1940ac2b3c3881c65c39baf528b12218e21c3f3..ce05224a0ee72549aad0b5eb391eeff462a88466 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-18  Aaron Bockover  <abockover@novell.com>
+
+       * test/test.[ch]:
+       * test/driver.c: Support pass/fail logging on tests to show group report
+
 2006-08-18  Aaron Bockover  <abockover@novell.com>
 
        * test/test.c: 
index b90ba415dab0fd90ebc14f93993994b3ee051afc..49ddfb8bc5f3951e3acc287fead17dc705ddbc2c 100644 (file)
@@ -92,7 +92,10 @@ gint main(gint argc, gchar **argv)
                        }
                        
                        if(run) {
-                               run_group(&(test_groups[j]));
+                               gint total, passed;
+                               run_group(&(test_groups[j]), &total, &passed);
+                               printf("  -- %d / %d (%g%%) --\n", passed, total,
+                                       ((gdouble)passed / (gdouble)total) * 100.0);
                        }
                }
        }
index cb387fd198aa95dbab85e88fb5f30ca1ee5a935c..e9c43a4b2615665327617607965bbda58fcbb075 100644 (file)
@@ -36,7 +36,7 @@
 
 static gchar *last_result = NULL;
 
-void 
+gboolean 
 run_test(Test *test)
 {
        gchar *result; 
@@ -44,25 +44,36 @@ run_test(Test *test)
        fflush(stdout);
        if((result = test->handler()) == NULL) {
                printf("OK\n");
+               return TRUE;
        } else {
                printf("FAILED (%s)\n", result);
                if(last_result == result) {
                        last_result = NULL;
                        g_free(result);
                }
+               
+               return FALSE;
        }
 }
 
 void
-run_group(Group *group)
+run_group(Group *group, gint *total, gint *passed)
 {
        Test *tests = group->handler();
-       gint i;
-       
+       gint i, _passed = 0;
+
        printf("[%s]\n", group->name);
 
        for(i = 0; tests[i].name != NULL; i++) {
-               run_test(&(tests[i]));
+               _passed += run_test(&(tests[i]));
+       }
+
+       if(total != NULL) {
+               *total = i;
+       }
+
+       if(passed != NULL) {
+               *passed = _passed;
        }
 }
 
index 3c6556d11d9084ce49aa2e1b2f78a6110677cb57..1befe7255ef915d1df8890c6981c2c7964187294 100644 (file)
@@ -48,8 +48,8 @@ struct _Group {
        LoadGroupHandler handler;
 };
 
-void run_test(Test *test);
-void run_group(Group *group);
+gboolean run_test(Test *test);
+void run_group(Group *group, gint *total, gint *passed);
 gchar *result(const gchar *format, ...);
 
 #define DEFINE_TEST_GROUP_INIT(name, table) \