r14569 - gnucash/branches/2.0 - Fix test of numerics in random splits, because multiplications might also turn out zero.

Derek Atkins warlord at cvs.gnucash.org
Thu Jul 27 21:18:04 EDT 2006


Author: warlord
Date: 2006-07-27 21:18:03 -0400 (Thu, 27 Jul 2006)
New Revision: 14569
Trac: http://svn.gnucash.org/trac/changeset/14569

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/ChangeLog
   gnucash/branches/2.0/src/engine/test-core/test-engine-stuff.c
Log:
Fix test of numerics in random splits, because multiplications might also turn out zero.

Merge from r14544



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:12938
   + d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:12945

Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog	2006-07-27 14:36:22 UTC (rev 14568)
+++ gnucash/branches/2.0/ChangeLog	2006-07-28 01:18:03 UTC (rev 14569)
@@ -32,6 +32,12 @@
 	  when user attempts to save a report with the same name as
 	  an existing report.
 
+2006-07-19  Christian Stimming <stimming at tuhh.de>
+
+	* src/engine/test-core/test-engine-stuff.c:
+	  Fix test of numerics in random splits, because multiplications
+	  might also turn out zero.
+
 2006-07-18  Christian Stimming <stimming at tuhh.de>
 
 	* configure.in:

Modified: gnucash/branches/2.0/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/branches/2.0/src/engine/test-core/test-engine-stuff.c	2006-07-27 14:36:22 UTC (rev 14568)
+++ gnucash/branches/2.0/src/engine/test-core/test-engine-stuff.c	2006-07-28 01:18:03 UTC (rev 14569)
@@ -1334,8 +1334,14 @@
         } while (gnc_numeric_check(amt) != GNC_ERROR_OK);
     }
     xaccSplitSetAmount(ret, amt);
+
+    /* Make sure val and amt have the same sign. Note that amt is
+       also allowed to be zero, because that is caused by a small
+       rate. */
     if (gnc_numeric_positive_p(val))
-        g_assert(gnc_numeric_positive_p(amt));
+        g_assert(!gnc_numeric_negative_p(amt)); /* non-negative amt */
+    else
+        g_assert(!gnc_numeric_positive_p(amt)); /* non-positive amt */
     
     xaccSplitSetSlots_nc(ret, get_random_kvp_frame());
     xaccTransCommitEdit(trn);



More information about the gnucash-changes mailing list