summaryrefslogtreecommitdiff
path: root/test/unit/t_amount.cc
Commit message (Collapse)AuthorAgeFilesLines
* More unit tests for amount_t::roundtoMax Nikulin2024-08-071-1/+13
| | | | | - Add some tests from comments to pull request #2361. - Fix decimal separator in earlier added tests.
* Fix copy on write for amount_t::in_place_roundtoMax Nikulin2024-08-061-3/+2
| | | | | | | | | | | | - Copy amount quantity before rounding. - Fix `amount_t::roundto(int)`. - Transform `balance/testRound` into `balance/testRoundto`. It was a mix of `round` and `roundto` operation with unclear purpose and was relying on `in_place_roundto` behavior modifying all copies. There is no unit tests for balance `round` and `unround` any more. Closes #2362
* Fix denominator of roundto resultMax Nikulin2024-08-051-0/+12
| | | | | | | | | | | | | | | | | | Multiprecision rational created from a double value may have large power of 2 denominator since fractional decimal numbers can not be represented as binary floating point numbers. It leads to failed assertion when result is compared to a value converted directly from strings. Use integer multiprecision arithmetics to round numbers to ensure proper denominator. Inspired by python gmpy2 package <https://github.com/aleaxit/gmpy/blob/3e4564ae9d/src/gmpy2_mpq_misc.c#L315> The change makes `roundto` symmetric for positive/negative arguments. Halves are rounded to nearest even. Rounded away from zero are discussed in #1663 and it may be achieved with minimal modification. - See #2329 - Closes #1983
* add unit tests for amount_t→floor/ceilJohann Klähn2013-01-151-0/+54
|
* Fixed several unit testsJohn Wiegley2011-02-041-9/+13
|
* Use Boost.Test instead of CppUnitJohn Wiegley2011-02-041-718/+724
|
* Untabified all source filesJohn Wiegley2010-06-111-21/+21
|
* Changed --european option to --decimal-commaJohn Wiegley2010-06-011-3/+3
| | | | Fixes #211 / 1736ACA5-5DE6-4826-AEB4-DB5B2A2217AC
* Redesigned the expr_t, predicate_t, query_t classesJohn Wiegley2009-11-091-9/+9
|
* Call times_initialize/shutdown in the unit testsJohn Wiegley2009-10-251-0/+2
|
* Don't increase precision so much when dividingJohn Wiegley2009-06-151-20/+20
| | | | | | | | | Slow the increase in internal precision when dividing amounts. Use "--debug amount.convert" if you wish to see this logic in action, if a case where incorrect rounding is suspected comes up. Fixes B68FFB0D-A9A0-479C-A6C0-68853F229333
* Enabled use of pre-compiled headers by defaultJohn Wiegley2009-03-101-0/+2
|
* Corrected warnings g++-4.3.3 was complaining aboutJohn Wiegley2009-02-281-5/+7
|
* Allow uncommoditized amounts to +/- with an amountJohn Wiegley2009-02-251-6/+6
| | | | Thus, you can say "$100 + 10" to increase it by $10.
* Be smarter about printing uncommoditized amountsJohn Wiegley2009-02-241-5/+5
|
* Restored the --budget optionJohn Wiegley2009-02-201-9/+9
|
* Fixed some incorrect #includes.John Wiegley2009-02-071-1/+1
|
* Largely removed all of Ledger's use of global variables, for the REPL's sake.John Wiegley2009-02-041-3/+7
|
* Removed serialization tests from the amount_t unit tests.John Wiegley2009-02-031-89/+0
|
* Added a more efficient amount_t::operator==, which changed semantics slightly.John Wiegley2009-01-311-4/+3
|
* Rationals based math is now passing the unit tests.John Wiegley2009-01-311-196/+23
|
* Several corrections to the way rationals are handled.John Wiegley2009-01-311-40/+47
|
* Don't perform rounding tests in Python.John Wiegley2009-01-311-0/+6
|
* Removed all dependency on gdtoa.John Wiegley2009-01-301-16/+3
|
* Fixed the amount_t unit test.John Wiegley2009-01-301-9/+9
|
* Unit test for Python are now auto-generated from the C++ tests.John Wiegley2009-01-281-64/+70
|
* Reorganized Ledger so that it builds as 7 separate libraries. This is mainlyJohn Wiegley2009-01-251-4/+8
| | | | to prove to myself that it has proper decoupling between prior code areas.
* Increase code coverage of the unit tests.John Wiegley2008-08-131-4/+0
|
* Moved the test sources around, so that all the unit tests are in test/unit.John Wiegley2008-08-051-0/+1576