r16082 - gnucash/trunk/src/engine/test-core - Limit the values of randomly generated numbers a little bit more.

David Hampton hampton at cvs.gnucash.org
Sun May 13 16:54:58 EDT 2007


Author: hampton
Date: 2007-05-13 16:54:57 -0400 (Sun, 13 May 2007)
New Revision: 16082
Trac: http://svn.gnucash.org/trac/changeset/16082

Modified:
   gnucash/trunk/src/engine/test-core/test-engine-stuff.c
Log:
Limit the values of randomly generated numbers a little bit more.
This prevents the test-lots case from dying when it attempts to divide
one split into two splits, and the ration of the two splits ends up
producing numbers less than 0.01.


Modified: gnucash/trunk/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2007-05-13 15:02:40 UTC (rev 16081)
+++ gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2007-05-13 20:54:57 UTC (rev 16082)
@@ -448,9 +448,9 @@
     }
     else
     {
-       gint64 norm = RAND_IN_RANGE (10ULL);
+       gint64 norm = RAND_IN_RANGE (8ULL);
 
-       /* multiple of 10, between 1 and 10 000 million */
+       /* multiple of 10, between 1 and 10 million */
        deno = 1;
        while (norm) 
        {
@@ -462,7 +462,7 @@
     /* Arbitrary random numbers can cause pointless overflow 
      * during calculations.  Limit dynamic range in hopes 
      * of avoiding overflow. */
-    numer = get_random_gint64()/100000;
+    numer = get_random_gint64()/1000000;
     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