One source of overflow during testing was changing the denominator on a
max-precision number. If the numerator was clamped with a large denominator,
changing to a smaller denominator without rescaling created a number that
would overflow later when applied to a commodity with a different SCU. This
change re-scales numerators in those cases so that the overflows don't happen.
The lot creation and balancing code uses gnc_numeric_foo_fixed(), assuming that
all amounts in a split have the same denominator, the account's SCU. Ensuring
this when creating test cases prevents spurious failures.
Increases the possible denominators to 1E10, but clamps the numerator to
1E13 * denom with 1E19 max. This is equivalent to $1E8/1 US in
Indonesian Rupiah, the currency with the lowest per-unit value in the
world at the time of this commit.
Avoids overflowing the amount and is anyway much more realistic:
Value = Amount * price, so a large "rate" means a small price. Since
get_random_rate() is biased to producing large rates (denom is fixed
at 100), it was effectively testing infinitesimal prices.
`new` implies some allocation. Since guid_new was actually constructing
a guid in place rather than allocating it, it makes much more sense to
call it guid_replace (or guid_construct). We went with guid_replace.
This was done by branching right before the original merge
and redoing a clean merge of the private-kvp branch again.
This result was then cherry-picked onto master with
git cherry-pick <merge-commit> -m 1
It was done like this because git merge would consider
the private-kvp branch already merged even after a revert
(see git-revert man page) and won't allow to merge a
second time on the same branch.
Resolved conflicts:
README.dependencies
src/app-utils/gnc-sx-instance-model.c
src/engine/cap-gains.c
src/engine/test/Makefile.am
src/gnome/assistant-hierarchy.c
src/import-export/import-match-map.c
src/import-export/import-utilities.c
src/import-export/ofx/gnc-ofx-kvp.c
src/libqof/qof/qofbook.cpp
src/libqof/qof/qofinstance-p.h
src/libqof/qof/qofinstance.cpp
src/libqof/qof/test/test-kvp_frame.c
src/report/report-gnome/gnc-plugin-page-report.c
Makes all kvp operations private to the object of which the kvp is
a member. Access from outside of the object is accomplished via
GObject Properties. A convenience function, qof_instance_set(),
is provided that wraps g_object_set and marks dirty the instance
so that it will be saved. It is still necessary to wrap calls in
begin_edit/commit to accomplish the save to the SQL backend. A
like-named wrapper, qof_instance_get() is provided to balance the API.
Note that the XML backend retains direct access to KVP to avoid having
to catalog the properties.
Lower the random gnc_numeric clamp to 44 bits; got an overflow at 48.
Prevent random query strings from including '\'; The sequence '\ ' causes an
error when passed to Scheme. See http://savannah.gnu.org/bugs/?31680.
MacOSX, for example, sets RAND_MAX at 65535, which rather limits the
size of random gint64s on that platform.
Fixing this revealed some odd behavior in creating random interest rates,
so created a specific function for that with a somewhat more reasonable
approach.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23493 57a11ea4-9604-0410-9ed3-97b8803252fd
The actual change to configure.ac (at line 1106) to enable -Wunused -- or rather to un-disable it -- is not included in order to not break the build for folks with buggy versions of swig.
(For example, https://sourceforge.net/tracker/?func=detail&aid=3530021&group_id=1645&atid=101645)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22203 57a11ea4-9604-0410-9ed3-97b8803252fd
of assuming that ACCT_TYPE_CREDITLINE is the last one.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21239 57a11ea4-9604-0410-9ed3-97b8803252fd
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19907 57a11ea4-9604-0410-9ed3-97b8803252fd
This patch changes the default rounding behaviour in GnuCash from
"Round to nearest even" to "Round away to infinity". See the bugreport
for more details on these different rounding methods.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19695 57a11ea4-9604-0410-9ed3-97b8803252fd
Note that only the type was renamed, but not any enums or function names.
Hence, the scheme wrappers should be unchanged completely (hopefully).
Discussed at http://lists.gnucash.org/pipermail/gnucash-devel/2010-March/027679.html
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18969 57a11ea4-9604-0410-9ed3-97b8803252fd
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header
Discussed at http://lists.gnucash.org/pipermail/gnucash-devel/2009-August/026121.html
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18675 57a11ea4-9604-0410-9ed3-97b8803252fd
The RFE wanted to specify the date of a scheduled transaction like this:
At the 15th of each month but if that is a saturday or a sunday then
at the next monday after that (or the friday before)
This patch implements this. The contributer writes:
Aside from some combinations being possible that don't make sense (because I
haven't looked at how to hide the extra combo boxes for them), and some awful
code in recurrenceNextInstance to stop it trying to go backwards (it may make
more sense to store the date that was going to be used next before it's changed
back/forward, so that that can be compared instead), it seems to work ok.
Patch by Simon Arlott.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17725 57a11ea4-9604-0410-9ed3-97b8803252fd
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 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.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16082 57a11ea4-9604-0410-9ed3-97b8803252fd
rename gnc_price_{get,set}_type() to _typestr() so it doesn't
conflict with the GType gnc_price_get_type() API.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15812 57a11ea4-9604-0410-9ed3-97b8803252fd
point directly to their parent and have a simple GList of children.
(The old method was alternating data structures in the form Account,
AccountGroup, Account, AccountGroup, etc.)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15647 57a11ea4-9604-0410-9ed3-97b8803252fd
Use shorter strings for commodity mnemonics.
Ensure that test splits amount and value have the same sign.
Avoid numerical overflow in rate calculation when generating test splits.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13718 57a11ea4-9604-0410-9ed3-97b8803252fd