Revert "Redo r23043 Don't print "warning" output in comparison functions."

Some extra files got pulled in...

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23063 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2013-06-25 17:04:30 +00:00
parent cd4f5d337d
commit 6fb2a93a85
18 changed files with 85 additions and 85 deletions

View File

@ -33,7 +33,7 @@ GNUCASH_NANO_VERSION=0
#src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load. #src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
GNUCASH_RESAVE_VERSION=19920 GNUCASH_RESAVE_VERSION=19920
# Initialize automake -- make sure we have at least version 1.9 # Initialize automake -- make sure we have at least version 1.9
AM_INIT_AUTOMAKE(1.12 [serial-tests dist-bzip2]) AM_INIT_AUTOMAKE([1.9 dist-bzip2])
# Parse out the version number # Parse out the version number
GNUCASH_VERSION_STRING=AC_PACKAGE_VERSION GNUCASH_VERSION_STRING=AC_PACKAGE_VERSION

View File

@ -557,7 +557,7 @@ xaccSplitEqualCheckBal (const char *tag, gnc_numeric a, gnc_numeric b)
str_a = gnc_numeric_to_string (a); str_a = gnc_numeric_to_string (a);
str_b = gnc_numeric_to_string (b); str_b = gnc_numeric_to_string (b);
PINFO ("%sbalances differ: %s vs %s", tag, str_a, str_b); PWARN ("%sbalances differ: %s vs %s", tag, str_a, str_b);
g_free (str_a); g_free (str_a);
g_free (str_b); g_free (str_b);
@ -580,7 +580,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
if (!sa || !sb) if (!sa || !sb)
{ {
PINFO ("one is NULL"); PWARN ("one is NULL");
return FALSE; return FALSE;
} }
@ -592,7 +592,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
{ {
if (qof_instance_guid_compare(sa, sb) != 0) if (qof_instance_guid_compare(sa, sb) != 0)
{ {
PINFO ("GUIDs differ"); PWARN ("GUIDs differ");
return FALSE; return FALSE;
} }
} }
@ -600,14 +600,14 @@ xaccSplitEqual(const Split *sa, const Split *sb,
/* If the same book, since these strings are cached we can just use pointer equality */ /* If the same book, since these strings are cached we can just use pointer equality */
if ((same_book && sa->memo != sb->memo) || (!same_book && g_strcmp0(sa->memo, sb->memo) != 0)) if ((same_book && sa->memo != sb->memo) || (!same_book && g_strcmp0(sa->memo, sb->memo) != 0))
{ {
PINFO ("memos differ: (%p)%s vs (%p)%s", PWARN ("memos differ: (%p)%s vs (%p)%s",
sa->memo, sa->memo, sb->memo, sb->memo); sa->memo, sa->memo, sb->memo, sb->memo);
return FALSE; return FALSE;
} }
if ((same_book && sa->action != sb->action) || (!same_book && g_strcmp0(sa->action, sb->action) != 0)) if ((same_book && sa->action != sb->action) || (!same_book && g_strcmp0(sa->action, sb->action) != 0))
{ {
PINFO ("actions differ: %s vs %s", sa->action, sb->action); PWARN ("actions differ: %s vs %s", sa->action, sb->action);
return FALSE; return FALSE;
} }
@ -619,7 +619,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
frame_a = kvp_frame_to_string (sa->inst.kvp_data); frame_a = kvp_frame_to_string (sa->inst.kvp_data);
frame_b = kvp_frame_to_string (sb->inst.kvp_data); frame_b = kvp_frame_to_string (sb->inst.kvp_data);
PINFO ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b); PWARN ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b);
g_free (frame_a); g_free (frame_a);
g_free (frame_b); g_free (frame_b);
@ -629,13 +629,13 @@ xaccSplitEqual(const Split *sa, const Split *sb,
if (sa->reconciled != sb->reconciled) if (sa->reconciled != sb->reconciled)
{ {
PINFO ("reconcile flags differ: %c vs %c", sa->reconciled, sb->reconciled); PWARN ("reconcile flags differ: %c vs %c", sa->reconciled, sb->reconciled);
return FALSE; return FALSE;
} }
if (timespec_cmp(&(sa->date_reconciled), &(sb->date_reconciled))) if (timespec_cmp(&(sa->date_reconciled), &(sb->date_reconciled)))
{ {
PINFO ("reconciled date differs"); PWARN ("reconciled date differs");
return FALSE; return FALSE;
} }
@ -647,7 +647,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
str_a = gnc_numeric_to_string (xaccSplitGetAmount (sa)); str_a = gnc_numeric_to_string (xaccSplitGetAmount (sa));
str_b = gnc_numeric_to_string (xaccSplitGetAmount (sb)); str_b = gnc_numeric_to_string (xaccSplitGetAmount (sb));
PINFO ("amounts differ: %s vs %s", str_a, str_b); PWARN ("amounts differ: %s vs %s", str_a, str_b);
g_free (str_a); g_free (str_a);
g_free (str_b); g_free (str_b);
@ -663,7 +663,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
str_a = gnc_numeric_to_string (xaccSplitGetValue (sa)); str_a = gnc_numeric_to_string (xaccSplitGetValue (sa));
str_b = gnc_numeric_to_string (xaccSplitGetValue (sb)); str_b = gnc_numeric_to_string (xaccSplitGetValue (sb));
PINFO ("values differ: %s vs %s", str_a, str_b); PWARN ("values differ: %s vs %s", str_a, str_b);
g_free (str_a); g_free (str_a);
g_free (str_b); g_free (str_b);
@ -686,7 +686,7 @@ xaccSplitEqual(const Split *sa, const Split *sb,
if (!xaccTransEqual(sa->parent, sb->parent, check_guids, check_txn_splits, if (!xaccTransEqual(sa->parent, sb->parent, check_guids, check_txn_splits,
check_balances, FALSE)) check_balances, FALSE))
{ {
PINFO ("transactions differ"); PWARN ("transactions differ");
return FALSE; return FALSE;
} }

View File

@ -780,7 +780,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
if (!ta || !tb) if (!ta || !tb)
{ {
PINFO ("one is NULL"); PWARN ("one is NULL");
return FALSE; return FALSE;
} }
@ -799,7 +799,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
if (!gnc_commodity_equal(ta->common_currency, tb->common_currency)) if (!gnc_commodity_equal(ta->common_currency, tb->common_currency))
{ {
PINFO ("commodities differ %s vs %s", PWARN ("commodities differ %s vs %s",
gnc_commodity_get_unique_name (ta->common_currency), gnc_commodity_get_unique_name (ta->common_currency),
gnc_commodity_get_unique_name (tb->common_currency)); gnc_commodity_get_unique_name (tb->common_currency));
return FALSE; return FALSE;
@ -812,7 +812,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
(void)gnc_timespec_to_iso8601_buff(ta->date_entered, buf1); (void)gnc_timespec_to_iso8601_buff(ta->date_entered, buf1);
(void)gnc_timespec_to_iso8601_buff(tb->date_entered, buf2); (void)gnc_timespec_to_iso8601_buff(tb->date_entered, buf2);
PINFO ("date entered differs: '%s' vs '%s'", buf1, buf2); PWARN ("date entered differs: '%s' vs '%s'", buf1, buf2);
return FALSE; return FALSE;
} }
@ -823,7 +823,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
(void)gnc_timespec_to_iso8601_buff(ta->date_posted, buf1); (void)gnc_timespec_to_iso8601_buff(ta->date_posted, buf1);
(void)gnc_timespec_to_iso8601_buff(tb->date_posted, buf2); (void)gnc_timespec_to_iso8601_buff(tb->date_posted, buf2);
PINFO ("date posted differs: '%s' vs '%s'", buf1, buf2); PWARN ("date posted differs: '%s' vs '%s'", buf1, buf2);
return FALSE; return FALSE;
} }
@ -832,14 +832,14 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
*/ */
if ((same_book && ta->num != tb->num) || (!same_book && g_strcmp0(ta->num, tb->num) != 0)) if ((same_book && ta->num != tb->num) || (!same_book && g_strcmp0(ta->num, tb->num) != 0))
{ {
PINFO ("num differs: %s vs %s", ta->num, tb->num); PWARN ("num differs: %s vs %s", ta->num, tb->num);
return FALSE; return FALSE;
} }
if ((same_book && ta->description != tb->description) if ((same_book && ta->description != tb->description)
|| (!same_book && g_strcmp0(ta->description, tb->description))) || (!same_book && g_strcmp0(ta->description, tb->description)))
{ {
PINFO ("descriptions differ: %s vs %s", ta->description, tb->description); PWARN ("descriptions differ: %s vs %s", ta->description, tb->description);
return FALSE; return FALSE;
} }
@ -851,7 +851,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
frame_a = kvp_frame_to_string (ta->inst.kvp_data); frame_a = kvp_frame_to_string (ta->inst.kvp_data);
frame_b = kvp_frame_to_string (tb->inst.kvp_data); frame_b = kvp_frame_to_string (tb->inst.kvp_data);
PINFO ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b); PWARN ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b);
g_free (frame_a); g_free (frame_a);
g_free (frame_b); g_free (frame_b);
@ -863,7 +863,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
{ {
if ((!ta->splits && tb->splits) || (!tb->splits && ta->splits)) if ((!ta->splits && tb->splits) || (!tb->splits && ta->splits))
{ {
PINFO ("only one has splits"); PWARN ("only one has splits");
return FALSE; return FALSE;
} }
@ -885,7 +885,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
if (!node_b) if (!node_b)
{ {
PINFO ("first has split %s and second does not", PWARN ("first has split %s and second does not",
guid_to_string (xaccSplitGetGUID (split_a))); guid_to_string (xaccSplitGetGUID (split_a)));
return FALSE; return FALSE;
} }
@ -901,14 +901,14 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
guid_to_string_buff (xaccSplitGetGUID (split_a), str_a); guid_to_string_buff (xaccSplitGetGUID (split_a), str_a);
guid_to_string_buff (xaccSplitGetGUID (split_b), str_b); guid_to_string_buff (xaccSplitGetGUID (split_b), str_b);
PINFO ("splits %s and %s differ", str_a, str_b); PWARN ("splits %s and %s differ", str_a, str_b);
return FALSE; return FALSE;
} }
} }
if (g_list_length (ta->splits) != g_list_length (tb->splits)) if (g_list_length (ta->splits) != g_list_length (tb->splits))
{ {
PINFO ("different number of splits"); PWARN ("different number of splits");
return FALSE; return FALSE;
} }
} }

View File

@ -374,20 +374,27 @@ xaccSplitEqualCheckBal (const char *tag, gnc_numeric a, gnc_numeric b)//
static void static void
test_xaccSplitEqualCheckBal (Fixture *fixture, gconstpointer pData) test_xaccSplitEqualCheckBal (Fixture *fixture, gconstpointer pData)
{ {
gchar *msg = "[xaccSplitEqualCheckBal] test balances differ: 123/100 vs 456/100"; gchar *msg = "[xaccSplitEqualCheckBal()] test balances differ: 123/100 vs 456/100";
guint loglevel = G_LOG_LEVEL_INFO, hdlr; guint loglevel = G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL, hdlr;
TestErrorStruct check = { loglevel, "gnc.engine", msg, 0 }; TestErrorStruct check = { loglevel, "gnc.engine", msg, 0 };
GLogFunc oldlogger;
gnc_numeric foo = gnc_numeric_create (123, 100); gnc_numeric foo = gnc_numeric_create (123, 100);
gnc_numeric bar = gnc_numeric_create (456, 100); gnc_numeric bar = gnc_numeric_create (456, 100);
hdlr = g_log_set_handler ("gnc.engine", loglevel, hdlr = g_log_set_handler ("gnc.engine", loglevel,
(GLogFunc)test_checked_handler, &check); (GLogFunc)test_checked_handler, &check);
test_add_error (&check);
oldlogger = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_list_handler, NULL);
g_assert_cmpint (fixture->func->xaccSplitEqualCheckBal ("test ", foo, foo), ==, TRUE); g_assert_cmpint (fixture->func->xaccSplitEqualCheckBal ("test ", foo, foo), ==, TRUE);
g_assert_cmpint (fixture->func->xaccSplitEqualCheckBal ("test ", foo, bar), ==, FALSE); g_assert_cmpint (fixture->func->xaccSplitEqualCheckBal ("test ", foo, bar), ==, FALSE);
g_assert_cmpint (check.hits, ==, 1); g_assert_cmpint (check.hits, ==, 2);
g_log_remove_handler ("gnc.engine", hdlr); g_log_remove_handler ("gnc.engine", hdlr);
g_log_set_default_handler (oldlogger, NULL);
test_clear_error_list ();
} }
/* xaccSplitEqual /* xaccSplitEqual
@ -400,39 +407,41 @@ test_xaccSplitEqual (Fixture *fixture, gconstpointer pData)
{ {
Split *split1 = xaccSplitClone (fixture->split); Split *split1 = xaccSplitClone (fixture->split);
Split *split2 = xaccDupeSplit (fixture->split); Split *split2 = xaccDupeSplit (fixture->split);
gchar *msg01 = "[xaccSplitEqual] one is NULL"; gchar *msg01 = "[xaccSplitEqual()] one is NULL";
gchar *msg02 = "[xaccSplitEqual] GUIDs differ"; gchar *msg02 = "[xaccSplitEqual()] GUIDs differ";
gchar *msg03; gchar *msg03;
gchar *msg04 = "[xaccSplitEqual] actions differ: foo vs bar"; gchar *msg04 = "[xaccSplitEqual()] actions differ: foo vs bar";
G_GNUC_UNUSED gchar *msg05 = "[xaccSplitEqual] kvp frames: differ foo vs bar"; G_GNUC_UNUSED gchar *msg05 = "[xaccSplitEqual()] kvp frames: differ foo vs bar";
G_GNUC_UNUSED gchar *msg06 = "[xaccSplitEqual] reconcile flags differ: foo vs bar"; G_GNUC_UNUSED gchar *msg06 = "[xaccSplitEqual()] reconcile flags differ: foo vs bar";
G_GNUC_UNUSED gchar *msg07 = "[xaccSplitEqual] reconciled date differs"; G_GNUC_UNUSED gchar *msg07 = "[xaccSplitEqual()] reconciled date differs";
G_GNUC_UNUSED gchar *msg08 = "[xaccSplitEqual] amounts differ: foo vs bar"; G_GNUC_UNUSED gchar *msg08 = "[xaccSplitEqual()] amounts differ: foo vs bar";
gchar *msg10 = "[xaccSplitEqual] transactions differ"; gchar *msg10 = "[xaccSplitEqual()] transactions differ";
gchar *msg11 = "[xaccTransEqual] one is NULL"; gchar *msg11 = "[xaccTransEqual()] one is NULL";
gchar *msg12 = "[xaccSplitEqualCheckBal] balances differ: 321/1000 vs 0/1"; gchar *msg12 = "[xaccSplitEqualCheckBal()] balances differ: 321/1000 vs 0/1";
gchar *msg13 = "[xaccSplitEqualCheckBal] cleared balances differ: 321/1000 vs 0/1"; gchar *msg13 = "[xaccSplitEqualCheckBal()] cleared balances differ: 321/1000 vs 0/1";
gchar *msg14 = "[xaccSplitEqualCheckBal] reconciled balances differ: 321/1000 vs 0/1"; gchar *msg14 = "[xaccSplitEqualCheckBal()] reconciled balances differ: 321/1000 vs 0/1";
gchar *logdomain = "gnc.engine"; gchar *logdomain = "gnc.engine";
guint loglevel = G_LOG_LEVEL_INFO; guint loglevel = G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL;
TestErrorStruct checkA = { loglevel, logdomain, msg01, 0 }; TestErrorStruct checkA = { loglevel, logdomain, msg01, 0 };
TestErrorStruct checkB = { loglevel, logdomain, msg10, 0 }; TestErrorStruct checkB = { loglevel, logdomain, msg10, 0 };
TestErrorStruct checkC = { loglevel, logdomain, msg11, 0 }; TestErrorStruct checkC = { loglevel, logdomain, msg11, 0 };
TestErrorStruct checkD = { loglevel, logdomain, msg14, 0 }; TestErrorStruct checkD = { loglevel, logdomain, msg14, 0 };
guint hdlr; guint hdlr;
GLogFunc oldlogger;
oldlogger = g_log_set_default_handler ((GLogFunc)test_null_handler, &checkA);
test_add_error (&checkA); test_add_error (&checkA);
test_add_error (&checkB); test_add_error (&checkB);
test_add_error (&checkC); test_add_error (&checkC);
test_add_error (&checkD); test_add_error (&checkD);
g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_list_handler, &checkA);
hdlr = g_log_set_handler (logdomain, loglevel, hdlr = g_log_set_handler (logdomain, loglevel,
(GLogFunc)test_list_handler, &checkA); (GLogFunc)test_checked_handler, &checkA);
/* Note that check_splits is just passed through to xaccTransEqual, so we don't vary it here. */ /* Note that check_splits is just passed through to xaccTransEqual, so we don't vary it here. */
/* Test that a NULL comparison fails */ /* Test that a NULL comparison fails */
g_assert (xaccSplitEqual (fixture->split, NULL, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, NULL, TRUE, TRUE, TRUE) == FALSE);
g_assert (xaccSplitEqual (NULL, split1, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (NULL, split1, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 2); g_assert_cmpint (checkA.hits, ==, 4);
g_assert_cmpint (checkB.hits, ==, 0); g_assert_cmpint (checkB.hits, ==, 0);
g_assert_cmpint (checkC.hits, ==, 0); g_assert_cmpint (checkC.hits, ==, 0);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
@ -440,33 +449,39 @@ test_xaccSplitEqual (Fixture *fixture, gconstpointer pData)
/* Clone creates splits with different GUIDs: Make sure that it fails comparison */ /* Clone creates splits with different GUIDs: Make sure that it fails comparison */
g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE);
/* Test that the parent comparison fails */ /* Test that the parent comparison fails */
g_log_remove_handler (logdomain, hdlr);
hdlr = g_log_set_handler (logdomain, loglevel,
(GLogFunc)test_list_handler, &checkA);
g_assert (xaccSplitEqual (fixture->split, split1, FALSE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split1, FALSE, TRUE, TRUE) == FALSE);
/* Now set split1's parent so that it passes -- we're also checking that the GUID check is disabled when we pass FALSE to check_guids */ /* Now set split1's parent so that it passes -- we're also checking that the GUID check is disabled when we pass FALSE to check_guids */
g_assert_cmpint (checkA.hits, ==, 3); g_assert_cmpint (checkA.hits, ==, 6);
g_assert_cmpint (checkB.hits, ==, 1); g_assert_cmpint (checkB.hits, ==, 2);
g_assert_cmpint (checkC.hits, ==, 1); g_assert_cmpint (checkC.hits, ==, 2);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
split1->parent = fixture->split->parent; split1->parent = fixture->split->parent;
g_log_remove_handler (logdomain, hdlr);
hdlr = g_log_set_handler (logdomain, loglevel,
(GLogFunc)test_list_handler, &checkA);
g_assert (xaccSplitEqual (fixture->split, split1, FALSE, TRUE, TRUE) == TRUE); g_assert (xaccSplitEqual (fixture->split, split1, FALSE, TRUE, TRUE) == TRUE);
/* Now set the GUIDs equal and see that the comparison passes */ /* Now set the GUIDs equal and see that the comparison passes */
g_object_set (G_OBJECT (split1), g_object_set (G_OBJECT (split1),
"guid", qof_instance_get_guid (QOF_INSTANCE(fixture->split)), "guid", qof_instance_get_guid (QOF_INSTANCE(fixture->split)),
NULL); NULL);
g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == TRUE); g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == TRUE);
g_assert_cmpint (checkA.hits, ==, 3); g_assert_cmpint (checkA.hits, ==, 6);
g_assert_cmpint (checkB.hits, ==, 1); g_assert_cmpint (checkB.hits, ==, 2);
g_assert_cmpint (checkC.hits, ==, 1); g_assert_cmpint (checkC.hits, ==, 2);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
/* Change the memo and action and test that each in turn causes the comparison to fail */ /* Change the memo and action and test that each in turn causes the comparison to fail */
split1->memo = "baz"; split1->memo = "baz";
msg03 = g_strdup_printf ("[xaccSplitEqual] memos differ: (%p)%s vs (%p)%s", msg03 = g_strdup_printf ("[xaccSplitEqual()] memos differ: (%p)%s vs (%p)%s",
fixture->split->memo, fixture->split->memo, fixture->split->memo, fixture->split->memo,
split1->memo, split1->memo); split1->memo, split1->memo);
checkA.msg = msg03; checkA.msg = msg03;
g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 4); g_assert_cmpint (checkA.hits, ==, 8);
g_assert_cmpint (checkB.hits, ==, 1); g_assert_cmpint (checkB.hits, ==, 2);
g_assert_cmpint (checkC.hits, ==, 1); g_assert_cmpint (checkC.hits, ==, 2);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
split1->memo = fixture->split->memo; split1->memo = fixture->split->memo;
split1->action = "bar"; split1->action = "bar";
@ -475,41 +490,40 @@ test_xaccSplitEqual (Fixture *fixture, gconstpointer pData)
g_log_remove_handler (logdomain, hdlr); g_log_remove_handler (logdomain, hdlr);
hdlr = g_log_set_handler (logdomain, loglevel, hdlr = g_log_set_handler (logdomain, loglevel,
(GLogFunc)test_list_handler, &checkA); (GLogFunc)test_list_handler, &checkA);
g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split1, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 6); g_assert_cmpint (checkA.hits, ==, 12);
g_assert_cmpint (checkB.hits, ==, 1); g_assert_cmpint (checkB.hits, ==, 2);
g_assert_cmpint (checkC.hits, ==, 1); g_assert_cmpint (checkC.hits, ==, 2);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
/* Split2 doesn't have balances copied from fixture->split, so the balance test fails */ /* Split2 doesn't have balances copied from fixture->split, so the balance test fails */
checkB.msg = msg12; checkB.msg = msg12;
checkC.msg = msg13; checkC.msg = msg13;
g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 6); g_assert_cmpint (checkA.hits, ==, 12);
g_assert_cmpint (checkB.hits, ==, 2); g_assert_cmpint (checkB.hits, ==, 4);
g_assert_cmpint (checkC.hits, ==, 1); g_assert_cmpint (checkC.hits, ==, 2);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
split2->balance = fixture->split->balance; split2->balance = fixture->split->balance;
g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 6); g_assert_cmpint (checkA.hits, ==, 12);
g_assert_cmpint (checkB.hits, ==, 2); g_assert_cmpint (checkB.hits, ==, 4);
g_assert_cmpint (checkC.hits, ==, 2); g_assert_cmpint (checkC.hits, ==, 4);
g_assert_cmpint (checkD.hits, ==, 0); g_assert_cmpint (checkD.hits, ==, 0);
split2->cleared_balance = fixture->split->cleared_balance; split2->cleared_balance = fixture->split->cleared_balance;
g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE); g_assert (xaccSplitEqual (fixture->split, split2, TRUE, TRUE, TRUE) == FALSE);
g_assert_cmpint (checkA.hits, ==, 6); g_assert_cmpint (checkA.hits, ==, 12);
g_assert_cmpint (checkB.hits, ==, 2); g_assert_cmpint (checkB.hits, ==, 4);
g_assert_cmpint (checkC.hits, ==, 2); g_assert_cmpint (checkC.hits, ==, 4);
g_assert_cmpint (checkD.hits, ==, 1); g_assert_cmpint (checkD.hits, ==, 2);
test_clear_error_list (); test_clear_error_list ();
g_assert (xaccSplitEqual (fixture->split, split2, TRUE, FALSE, TRUE) == TRUE); g_assert (xaccSplitEqual (fixture->split, split2, TRUE, FALSE, TRUE) == TRUE);
g_object_unref (split1); g_object_unref (split1);
g_object_unref (split2); g_object_unref (split2);
test_clear_error_list (); test_clear_error_list ();
g_log_remove_handler (logdomain, hdlr); g_log_set_default_handler (oldlogger, NULL);
g_free (msg03); g_free (msg03);
} }
/* xaccSplitGetAccount /* xaccSplitGetAccount
@ -544,7 +558,6 @@ test_xaccSplitCommitEdit (Fixture *fixture, gconstpointer pData)
gchar *msg2 = "[xaccSplitCommitEdit()] Account grabbed split prematurely."; gchar *msg2 = "[xaccSplitCommitEdit()] Account grabbed split prematurely.";
gchar *logdomain = "gnc.engine"; gchar *logdomain = "gnc.engine";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL; guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
guint infolevel = G_LOG_LEVEL_INFO;
guint hdlr; guint hdlr;
TestErrorStruct checkA = { loglevel, logdomain, msg1, 0 }; TestErrorStruct checkA = { loglevel, logdomain, msg1, 0 };
TestErrorStruct checkB = { loglevel, logdomain, msg2, 0 }; TestErrorStruct checkB = { loglevel, logdomain, msg2, 0 };
@ -586,6 +599,7 @@ test_xaccSplitCommitEdit (Fixture *fixture, gconstpointer pData)
g_assert_cmpint (checkA.hits, ==, 4); g_assert_cmpint (checkA.hits, ==, 4);
g_assert_cmpint (checkB.hits, ==, 2); g_assert_cmpint (checkB.hits, ==, 2);
g_log_remove_handler (logdomain, hdlr);
qof_instance_mark_clean (QOF_INSTANCE (fixture->split->parent)); qof_instance_mark_clean (QOF_INSTANCE (fixture->split->parent));
g_object_set (fixture->split->acc, g_object_set (fixture->split->acc,
"sort-dirty", FALSE, "sort-dirty", FALSE,
@ -612,7 +626,6 @@ test_xaccSplitCommitEdit (Fixture *fixture, gconstpointer pData)
g_assert (fixture->split->orig_parent == fixture->split->parent); g_assert (fixture->split->orig_parent == fixture->split->parent);
g_log_remove_handler (logdomain, hdlr);
test_signal_free (sig1); test_signal_free (sig1);
test_signal_free (sig2); test_signal_free (sig2);
test_destroy (oacc); test_destroy (oacc);
@ -1259,18 +1272,6 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData)
Account *acc1 = xaccMallocAccount (book); Account *acc1 = xaccMallocAccount (book);
Account *acc2 = xaccMallocAccount (book); Account *acc2 = xaccMallocAccount (book);
Account *acc3 = xaccMallocAccount (book); Account *acc3 = xaccMallocAccount (book);
gchar *msg1 = "get_corr_account_split: assertion `sa' failed";
gchar *logdomain = "gnc.engine";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct check = { loglevel, logdomain, msg1, 0 };
gnc_numeric value = { 360, 240 };
gnc_numeric old_val = fixture->split->value;
gnc_numeric old_amt = fixture->split->amount;
GLogFunc oldlogger = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler,
&check);
xaccAccountSetCommodity (acc1, fixture->curr); xaccAccountSetCommodity (acc1, fixture->curr);
xaccAccountSetCommodity (acc2, fixture->curr); xaccAccountSetCommodity (acc2, fixture->curr);
@ -1301,13 +1302,12 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData)
g_assert (!fixture->func->get_corr_account_split(fixture->split, &result)); g_assert (!fixture->func->get_corr_account_split(fixture->split, &result));
g_assert (result == NULL); g_assert (result == NULL);
g_assert_cmpint (check.hits, ==, 0);
g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_null_handler,
NULL);
g_assert (!fixture->func->get_corr_account_split(NULL, &result)); g_assert (!fixture->func->get_corr_account_split(NULL, &result));
g_assert (result == NULL); g_assert (result == NULL);
g_assert_cmpint (check.hits, ==, 1);
g_log_set_default_handler (oldlogger, NULL);
test_destroy (split1); test_destroy (split1);
test_destroy (split2); test_destroy (split2);
test_destroy (split3); test_destroy (split3);