[Gnucash-changes] r13124 - gnucash/trunk - A few test changes to
make sure we don't fail when we're very unlucky.
Derek Atkins
warlord at cvs.gnucash.org
Sun Feb 5 15:38:47 EST 2006
Author: warlord
Date: 2006-02-05 15:38:46 -0500 (Sun, 05 Feb 2006)
New Revision: 13124
Trac: http://svn.gnucash.org/trac/changeset/13124
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/engine/test-core/test-engine-stuff.c
Log:
A few test changes to make sure we don't fail when we're very unlucky.
- make sure a random group always has at least two accounts
- fix "make random transaction" to tell us when we don't
have at least two accounts.
- free the results of xaccGroupGetSubAccounts().
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-02-05 20:00:33 UTC (rev 13123)
+++ gnucash/trunk/ChangeLog 2006-02-05 20:38:46 UTC (rev 13124)
@@ -8,6 +8,12 @@
* src/backend/file/Makefile.am: link against libcore-utils.
+ * src/engine/test/test-engine-stuff.c:
+ - make sure a random group always has at least two accounts
+ - fix "make random transaction" to tell us when we don't
+ have at least two accounts.
+ - free the results of xaccGroupGetSubAccounts().
+
2006-02-05 Neil Williams <linux at codehelp.co.uk>
* lib/libqof/qof/qoflog.c :
Modified: gnucash/trunk/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/trunk/src/engine/test-core/test-engine-stuff.c 2006-02-05 20:00:33 UTC (rev 13123)
+++ gnucash/trunk/src/engine/test-core/test-engine-stuff.c 2006-02-05 20:38:46 UTC (rev 13124)
@@ -872,6 +872,7 @@
make_random_group (QofBook *book, AccountGroup *group)
{
int depth;
+ GList *account_list;
g_return_if_fail (book);
g_return_if_fail (group);
@@ -880,6 +881,12 @@
depth = get_random_int_in_range (1, max_group_depth);
make_random_group_depth (book, group, depth);
+
+ /* Make sure we have at least two accounts! */
+ account_list = xaccGroupGetSubAccounts (xaccGetAccountGroup (book));
+ if (1 >= g_list_length (account_list))
+ make_random_group_depth (book, group, 1);
+ g_list_free(account_list);
}
AccountGroup *
@@ -1398,7 +1405,12 @@
}
/* Gotta have at least two different accounts */
- if (1 >= g_list_length (account_list)) return NULL;
+ if (1 >= g_list_length (account_list)) {
+ failure_args("engine-stuff", __FILE__, __LINE__,
+ "get_random_transaction_with_currency: account_list too short");
+ g_list_free(account_list);
+ return NULL;
+ }
trans = xaccMallocTransaction(book);
@@ -1420,6 +1432,7 @@
xaccTransSetSlots_nc(trans, f);
add_random_splits(book, trans, account_list);
+ g_list_free(account_list);
if (get_random_int_in_range (1, 10) == 1)
{
More information about the gnucash-changes
mailing list