[Gnucash-changes] r13738 - gnucash/trunk/src/engine/test - Make the tests for growing commodity tables more accurate -

Chris Shoemaker chris at cvs.gnucash.org
Wed Apr 5 18:30:02 EDT 2006


Author: chris
Date: 2006-04-05 18:30:00 -0400 (Wed, 05 Apr 2006)
New Revision: 13738
Trac: http://svn.gnucash.org/trac/changeset/13738

Modified:
   gnucash/trunk/src/engine/test/test-commodities.c
Log:
   Make the tests for growing commodity tables more accurate - 
   silences incorrect failures.


Modified: gnucash/trunk/src/engine/test/test-commodities.c
===================================================================
--- gnucash/trunk/src/engine/test/test-commodities.c	2006-04-05 17:59:14 UTC (rev 13737)
+++ gnucash/trunk/src/engine/test/test-commodities.c	2006-04-05 22:30:00 UTC (rev 13738)
@@ -128,8 +128,7 @@
     }
     
     {
-        int i;
-        int j;
+        int i, j, num_total = 0;
         gnc_commodity_table *tbl;
         gnc_commodity *coms[20];
         QofBook *book;
@@ -144,14 +143,18 @@
         {
             coms[i] = get_random_commodity(book);
 
+            if (!gnc_commodity_table_lookup(
+                tbl, gnc_commodity_get_namespace(coms[i]),
+                gnc_commodity_get_mnemonic(coms[i])))
+                num_total++;
             do_test(
                 gnc_commodity_table_insert(tbl, coms[i]) != NULL,
                 "insert test");
 
             do_test_args(
-                (int)gnc_commodity_table_get_size(tbl) == i + 1,
+                (int)gnc_commodity_table_get_size(tbl) == num_total,
                 "test next size table", __FILE__, __LINE__,
-                "should be %d and is %d", i + 1,
+                "should be %d and is %d", num_total,
                 gnc_commodity_table_get_size(tbl));
 
             for(j = 0; j <= i; j++)
@@ -190,5 +193,5 @@
     qof_query_shutdown();
     guid_shutdown();
     qof_object_shutdown ();
-    return 0;
+    return get_rv();
 }



More information about the gnucash-changes mailing list