Add total assertions

Signed-off-by: Roland Stigge <stigge@antcom.de>

--- autounit-0.20.1.orig/c-unit/test.c	2006-07-13 22:50:07.000000000 +0200
+++ autounit-0.20.1/c-unit/test.c	2006-09-05 17:49:55.000000000 +0200
@@ -139,6 +139,7 @@
    * GString *test_name;
    * gboolean test_run;
    * GString *test_status;
+   * gint     total_assertions;
    * gint     failed_assertions;
    * gdouble  test_seconds_elapsed;
    * gulong   test_useconds_elapsed;
@@ -149,6 +150,7 @@
   GString *tmp_test_name_ns;
   GString *tmp_test_run_ns;
   GString *tmp_test_status_ns;
+  GString *tmp_total_assertions_ns;
   GString *tmp_failed_assertions_ns;
   GString *tmp_test_seconds_elapsed_ns;
   GString *tmp_test_useconds_elapsed_ns;
@@ -156,6 +158,7 @@
   tmp_test_name_ns = au_gstring_to_netstring(t->test_name);
   tmp_test_run_ns  = au_gboolean_to_netstring(t->test_run);
   tmp_test_status_ns = au_gstring_to_netstring(t->test_status);
+  tmp_total_assertions_ns = au_gint_to_netstring(t->total_assertions);
   tmp_failed_assertions_ns = au_gint_to_netstring(t->failed_assertions);
   tmp_test_seconds_elapsed_ns = au_gdouble_to_netstring(
       t->test_seconds_elapsed);
@@ -166,6 +169,7 @@
   str = g_string_append(str,tmp_test_name_ns->str);
   str = g_string_append(str,tmp_test_run_ns->str);
   str = g_string_append(str,tmp_test_status_ns->str);
+  str = g_string_append(str,tmp_total_assertions_ns->str);
   str = g_string_append(str,tmp_failed_assertions_ns->str);
   str = g_string_append(str,tmp_test_seconds_elapsed_ns->str);
   str = g_string_append(str,tmp_test_useconds_elapsed_ns->str);
@@ -175,6 +179,7 @@
   g_string_free(tmp_test_name_ns,TRUE);
   g_string_free(tmp_test_run_ns,TRUE);
   g_string_free(tmp_test_status_ns,TRUE);
+  g_string_free(tmp_total_assertions_ns,TRUE);
   g_string_free(tmp_failed_assertions_ns,TRUE);
   g_string_free(tmp_test_seconds_elapsed_ns,TRUE);
   g_string_free(tmp_test_useconds_elapsed_ns,TRUE);
@@ -190,6 +195,7 @@
    * string test_name
    * boolean test_run
    * string test_status
+   * int total_assertions
    * int failed_assertions
    * double test_seconds_elapsed
    * ulong test_useconds_elapsed
@@ -198,6 +204,7 @@
   GString *test_name_ns;
   GString *test_run_ns;
   GString *test_status_ns;
+  GString *total_assertions_ns;
   GString *failed_assertions_ns;
   GString *test_seconds_elapsed_ns;
   GString *test_useconds_elapsed_ns;
@@ -209,6 +216,7 @@
   test_name_ns = au_pop_netstring(tmp_ns);
   test_run_ns = au_pop_netstring(tmp_ns);
   test_status_ns = au_pop_netstring(tmp_ns);
+  total_assertions_ns = au_pop_netstring(tmp_ns);
   failed_assertions_ns = au_pop_netstring(tmp_ns);
   test_seconds_elapsed_ns = au_pop_netstring(tmp_ns);
   test_useconds_elapsed_ns = au_pop_netstring(tmp_ns);
@@ -219,6 +227,7 @@
   us_test = au_new_test(test_name,0);
   us_test->test_run = au_netstring_to_gboolean(test_run_ns);
   g_string_append(us_test->test_status, test_status->str);
+  us_test->total_assertions = au_netstring_to_gint(total_assertions_ns);
   us_test->failed_assertions = au_netstring_to_gint(failed_assertions_ns);
   us_test->test_seconds_elapsed = au_netstring_to_gdouble(
       test_seconds_elapsed_ns);
@@ -228,6 +237,7 @@
   g_string_free(tmp_ns,TRUE);
   g_string_free(test_name,TRUE);
   g_string_free(test_status,TRUE);
+  g_string_free(total_assertions_ns,TRUE);
   g_string_free(failed_assertions_ns,TRUE);
   g_string_free(test_seconds_elapsed_ns,TRUE);
   g_string_free(test_useconds_elapsed_ns,TRUE);
@@ -338,6 +348,7 @@
     
 	  /* Copy child's assertions to the parent's copy, we'll assume
 	     that the test_name didn't change. */
+	  t->total_assertions += tmp_t->total_assertions;
 	  t->failed_assertions += tmp_t->failed_assertions;
 	  t->test_seconds_elapsed = tmp_t->test_seconds_elapsed;
 	  t->test_useconds_elapsed = tmp_t->test_useconds_elapsed;
--- autounit-0.20.1.orig/c-unit/TEST/test-au-netstring.c	2006-07-13 22:50:06.000000000 +0200
+++ autounit-0.20.1/c-unit/TEST/test-au-netstring.c	2006-09-06 15:27:02.000000000 +0200
@@ -268,8 +268,8 @@
   b_t = au_new_test(g_string_new("test_sample_test"),test_sample_test);
   str_test = au_test_serialize(b_t);
   au_assert(t,strcmp(str_test->str,
-		     "46:16:test_sample_test,1:0,0:,1:0,8:0.000000,1:0,,")==0,
-	    "serialized test is what we expect");
+		     "50:16:test_sample_test,1:0,0:,1:0,1:0,8:0.000000,1:0,,")==0,
+	    "serialized test isn't what we expect");
   /* When the serialized test is read from the child's pipe with au_read_netstream
    * it will have unwrapped the outer netstring encoding already, we'll simulate
    * this here with a call to au_netstring_to_gstring(). */
@@ -283,6 +283,8 @@
   au_assert(t,us_test->test_status!=0,"test_status isn't allocated");
   au_assert(t,strcmp(b_t->test_status->str,us_test->test_status->str)==0,
 	    "test_status mismatch");
+  au_assert(t,b_t->total_assertions == us_test->total_assertions,
+	    "total_assertions mismatch");
   au_assert(t,b_t->failed_assertions == us_test->failed_assertions,
 	    "failed_assertions mismatch");
   au_assert(t,b_t->test_seconds_elapsed == us_test->test_seconds_elapsed,

