Make the tests for growing commodity tables more accurate -

silences incorrect failures.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13738 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-04-05 22:30:00 +00:00
parent 0609d99045
commit 720f543e25

View File

@ -128,8 +128,7 @@ test_commodity(void)
} }
{ {
int i; int i, j, num_total = 0;
int j;
gnc_commodity_table *tbl; gnc_commodity_table *tbl;
gnc_commodity *coms[20]; gnc_commodity *coms[20];
QofBook *book; QofBook *book;
@ -144,14 +143,18 @@ test_commodity(void)
{ {
coms[i] = get_random_commodity(book); 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( do_test(
gnc_commodity_table_insert(tbl, coms[i]) != NULL, gnc_commodity_table_insert(tbl, coms[i]) != NULL,
"insert test"); "insert test");
do_test_args( 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__, "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)); gnc_commodity_table_get_size(tbl));
for(j = 0; j <= i; j++) for(j = 0; j <= i; j++)
@ -190,5 +193,5 @@ main (int argc, char **argv)
qof_query_shutdown(); qof_query_shutdown();
guid_shutdown(); guid_shutdown();
qof_object_shutdown (); qof_object_shutdown ();
return 0; return get_rv();
} }