Commit Graph

139 Commits

Author SHA1 Message Date
John Ralls
ac29ad3cef Remove direct query of KVP.
Wasn't actually used anywhere, and it's not something we want to
support.
2015-07-03 17:13:11 -07:00
John Ralls
ac515d6ce2 Stop testing fractional seconds.
We don't use them in real code, so the new implementation isn't going to
support them.
2015-04-28 17:52:56 -07:00
Robert Fewell
e12c7f7514 Bug 738462 Part 1 - Add search for strings equal.
Add the ability to search for strings that are equal in queries.
2015-01-28 17:42:22 +01:00
Mike Alexander
735ee38b65 Revert "Some type mismatch fixes to make it build with clang in MacOSX Mavericks."
This reverts commit 78fea12afc.
2014-12-11 17:24:48 -05:00
Mike Alexander
78fea12afc Some type mismatch fixes to make it build with clang in MacOSX Mavericks.
These may not be the best fixes, but they make things build again with
XCode 6.1.1 in MacOSX 10.9.5.
2014-12-11 02:59:21 -05:00
John Ralls
495c939c3e C++-numeric: Fix up some 64-bit and GCC problems.
Still won't compile on gcc-4.7 (f18) because of poor C++11 compliance wrt UINT64_MAX, UINT64_C, and PRIu_64 macros.
2014-12-07 11:42:39 -08:00
John Ralls
503a607090 More overflow-avoidance.
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.
2014-12-03 16:28:55 -08:00
John Ralls
456e121930 Ensure random numeric denominator is the account SCU when creating splits.
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.
2014-12-03 16:28:54 -08:00
John Ralls
c4d649bc93 A better, clearer approach to constraining random gnc_numerics
Which happens to actually work.
2014-12-03 16:28:54 -08:00
John Ralls
9d029d7f82 More realistic get_random_gnc_numeric()
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.
2014-12-03 16:28:53 -08:00
lmat
b109c94f2c Removing deprecated #define
kvp_value should not be used, but rather the standard KvpValue. Using
the deprecated value just adds one more variation on this typename.
2014-09-21 13:32:59 -07:00
lmat
d2913915e6 Removed binary from kvpvalues
It looks like the binary kvpvalue wasn't being used, and, since
it is difficult to deal with, it is easiest to remove it altogether.
2014-09-16 15:12:12 -07:00
John Ralls
1141e9a9b8 Merge branch 'maint' 2014-09-05 12:06:16 -07:00
lmat
3363a2c572 Replace C++ reserved words for future compatibility with C++ 2014-09-05 11:56:48 -07:00
John Ralls
3f8718ea3b Divide the value by the rate to get the amount.
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.
2014-08-22 16:30:12 -07:00
lmat
9c82a1e9bc Rename guid_new to guid_replace
`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.
2014-07-25 08:26:54 -04:00
Geert Janssens
45cb5504f3 Merge branch 'private-kvp' into master again
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
2014-05-07 18:32:47 +02:00
Geert Janssens
ae98012d0c Revert "Merge branch 'private-kvp'"
This reverts commit f49983b801, reversing
changes made to acad5a02bb.
2014-05-07 18:32:44 +02:00
John Ralls
f49983b801 Merge branch 'private-kvp'
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.
2014-05-01 14:57:34 -07:00
John Ralls
329f3079e0 Work around some test issues.
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.
2014-03-29 16:02:50 -07:00
John Ralls
de3a6e3df2 Handle RAND_MAX < 2^32 in get_random_gint64()
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
2013-12-05 21:54:18 +00:00
John Ralls
9ea9896620 Remove convenience functions which return a pointer to kvm_data. 2013-11-04 11:32:24 -08:00
John Ralls
1f3fbf4b52 Make most QofInstance functions private.
Import qofinstance-p.h into QofInstance child classes.
2013-11-04 11:32:18 -08:00
Geert Janssens
45708e5620 Fix some warnings generated by Eclipse's static code analysis plugin
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22649 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-15 10:30:35 +00:00
John Ralls
b391754ff6 Correct -Wunused warnings
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
2012-05-26 23:47:34 +00:00
Mike Alexander
5f980c8d1a Use the correct #define for the number of account types instead
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
2011-09-06 07:21:04 +00:00
Christian Stimming
8b3650e07f (cppcheck) Fix a possible memory leak
Patch by Aurimas Fišeras.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21200 57a11ea4-9604-0410-9ed3-97b8803252fd
2011-08-21 19:42:34 +00:00
Christian Stimming
88cb0b1b20 Replace more obsolete #define'd function names by their current names.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19939 57a11ea4-9604-0410-9ed3-97b8803252fd
2010-12-14 20:22:48 +00:00
Christian Stimming
febe74e6c0 Replace more obsolete #define'd function names by their current names.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19936 57a11ea4-9604-0410-9ed3-97b8803252fd
2010-12-13 21:00:23 +00:00
Christian Stimming
6dfd0f28f4 Re-indentation of source code.
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
2010-12-04 21:09:57 +00:00
Geert Janssens
a0c19b4c71 Bug #502853 - Incorrent tax rounding in invoice (rounding of .5)
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
2010-10-23 10:38:48 +00:00
Christian Stimming
67c6a3d0cf Replace some renamed functions by their real new names, removing the annoying #defines.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19652 57a11ea4-9604-0410-9ed3-97b8803252fd
2010-10-13 16:16:04 +00:00
Christian Stimming
de83edb352 And more const-correctnes in SchedXaction.h
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19462 57a11ea4-9604-0410-9ed3-97b8803252fd
2010-08-22 11:10:12 +00:00
Christian Stimming
a322015eb8 Rename the type GUID into GncGUID because on Windows, the system headers have a type GUID which clashes with ours.
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
2010-03-27 21:01:21 +00:00
Christian Stimming
a824e611e2 Re-indentation of source code, next batch.
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
2010-02-18 05:31:54 +00:00
Christian Stimming
8cecfea8da Bug #106401: Add SX weekend occurence to be shifted to weekdays
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
2008-11-26 21:17:30 +00:00
Derek Atkins
6f39c0c26e (#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
2007-12-24 21:18:09 +00:00
Joshua Sled
f5923ae956 Remove FreqSpec.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16387 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-08-05 21:24:16 +00:00
David Hampton
0964eebb45 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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16082 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-05-13 20:54:57 +00:00
David Hampton
cfa50383a5 Replace a function name mapping with the real function call.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15936 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-04-19 05:09:34 +00:00
Derek Atkins
49c4d834e3 convert price/pricedb objects to GObject initialization
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
2007-04-05 00:24:38 +00:00
Joshua Sled
09d90de350 Unused identifier cleanup.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15718 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-03-15 00:56:52 +00:00
David Hampton
6fbada92ec Remove all traces of the AccountGroup data structure. Accounts now
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
2007-02-23 01:23:31 +00:00
Joshua Sled
d20436a81e Fix up SX test fixtures for Recurrence transition
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15614 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-02-19 00:14:53 +00:00
Joshua Sled
eb73260220 Fold branches/sx-cleanup/ [14463:15384] back into trunk/.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15399 57a11ea4-9604-0410-9ed3-97b8803252fd
2007-01-19 23:45:45 +00:00
David Hampton
fc5fe1e5a6 Regularize the account type names into the form ACCT_TYPE_xxx.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14599 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-08-06 22:07:12 +00:00
Christian Stimming
894d2ee6c3 Fix test of numerics in random splits, because multiplications might also turn out zero.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14544 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-07-19 16:03:05 +00:00
Joshua Sled
3a2fa62d87 Fix test-query failure.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13942 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-07 21:39:30 +00:00
Chris Shoemaker
90864dcb27 Correctly ensure that the amount and value of test Splits have the same sign
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13919 57a11ea4-9604-0410-9ed3-97b8803252fd
2006-05-05 00:17:04 +00:00
Chris Shoemaker
ec1bcb86df Return the actual number of test failures with get_rv().
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
2006-03-31 01:43:16 +00:00