mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-11-03 12:50:50 -06:00
(#492137) Re-apply r16619 and make a change to the test
harness to actually get the checks to pass with r16690. This was an overflow in the test harness. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16716 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
244a779d7a
commit
6f39c0c26e
2 files changed
+13
-7
No files matched your search
@@ -168,7 +168,7 @@ finder_helper (GNCLot *lot, gpointer user_data)
|
||||
static inline GNCLot *
|
||||
xaccAccountFindOpenLot (Account *acc, gnc_numeric sign,
|
||||
gnc_commodity *currency,
|
||||
guint64 guess,
|
||||
gint64 guess,
|
||||
gboolean (*date_pred)(Timespec, Timespec))
|
||||
{
|
||||
struct find_lot_s es;
|
||||
@@ -195,7 +195,7 @@ xaccAccountFindEarliestOpenLot (Account *acc, gnc_numeric sign,
|
||||
sign.denom);
|
||||
|
||||
lot = xaccAccountFindOpenLot (acc, sign, currency,
|
||||
G_MAXUINT64, earliest_pred);
|
||||
G_MAXINT64, earliest_pred);
|
||||
LEAVE ("found lot=%p %s baln=%s", lot, gnc_lot_get_title (lot),
|
||||
gnc_num_dbg_to_string(gnc_lot_get_balance(lot)));
|
||||
return lot;
|
||||
@@ -210,7 +210,7 @@ xaccAccountFindLatestOpenLot (Account *acc, gnc_numeric sign,
|
||||
sign.num, sign.denom);
|
||||
|
||||
lot = xaccAccountFindOpenLot (acc, sign, currency,
|
||||
0, latest_pred);
|
||||
G_MININT64, latest_pred);
|
||||
LEAVE ("found lot=%p %s", lot, gnc_lot_get_title (lot));
|
||||
return lot;
|
||||
}
|
||||
|
||||
@@ -447,9 +447,9 @@ get_random_gnc_numeric(void)
|
||||
}
|
||||
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 @@ get_random_gnc_numeric(void)
|
||||
|
||||
/* 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;
|
||||
|
||||
Reference in new issue
Block a user