r16831 - gnucash/branches/2.2/src/engine/test-core - [r16716] (#492137) Make a change to the test harness to actually get the checks to pass with r16690.
Andreas Köhler
andi5 at cvs.gnucash.org
Sun Jan 6 12:37:02 EST 2008
Author: andi5
Date: 2008-01-06 12:37:01 -0500 (Sun, 06 Jan 2008)
New Revision: 16831
Trac: http://svn.gnucash.org/trac/changeset/16831
Modified:
gnucash/branches/2.2/src/engine/test-core/test-engine-stuff.c
Log:
[r16716] (#492137) Make a change to the test harness to actually get the checks to pass with r16690.
This was an overflow in the test harness.
Committed by warlord.
Modified: gnucash/branches/2.2/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/branches/2.2/src/engine/test-core/test-engine-stuff.c 2008-01-06 16:27:40 UTC (rev 16830)
+++ gnucash/branches/2.2/src/engine/test-core/test-engine-stuff.c 2008-01-06 17:37:01 UTC (rev 16831)
@@ -447,9 +447,9 @@
}
else
{
- gint64 norm = RAND_IN_RANGE (8ULL);
+ gint64 norm = RAND_IN_RANGE (7ULL);
- /* multiple of 10, between 1 and 10 million */
+ /* multiple of 10, between 1 and 1 million */
deno = 1;
while (norm)
{
@@ -460,8 +460,14 @@
/* Arbitrary random numbers can cause pointless overflow
* during calculations. Limit dynamic range in hopes
- * of avoiding overflow. */
- numer = get_random_gint64()/1000000;
+ * of avoiding overflow. Right now limit it to approx 2^48.
+ * The initial division is to help us down towards the range.
+ * The loop is to "make sure" we get there. We might
+ * want to make this dependent on "deno" in the future.
+ */
+ do {
+ numer = get_random_gint64()/1000000;
+ } while ((numer >> 31) > 0x1FFFF);
if (0 == numer) numer = 1;
/* Make sure we have a non-zero denominator */
if (0 == deno) deno = 1;
More information about the gnucash-changes
mailing list