| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
The manpage documents `=regex` as equivalent to the `note regex` query
syntax, but the former does not actually work as the parser only handles
an equals sign in the case of `tag type=dining` syntax, and doesn't
handle the case where an equals sign starts a note query.
Fixing this does break queries like `tag type = dining` with spaces
around the equals sign, but that syntax was not intended or documented.
Closes: #2275
|
|
|
|
| |
also add unit tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unbuffer python's stdio to avoid output getting stuck in buffer when
stdout is not a TTY. Normally buffers are flushed by `Py_Finalize` but
Boost has a long-standing issue preventing the proper shutdown of the
interpreter with `Py_Finalize` when embedded [1].
This applies the same fix as 139beba but to any ledger usage rather than
only the test suite. I removed `PYTHONUNBUFFERED=1` from tests as there
is no expectation that users should need to have this set for ledger to
function.
For example without this fix piping ledger into cat usually loses any
output (unless the output is large enough to cause the buffer to flush):
$ ./ledger -f "test/baseline/feat-value_py3.test" reg
<class 'bool'> True
[...]
$ ./ledger -f "test/baseline/feat-value_py3.test" reg | cat
$
Interestingly `--verify` causes `python_interpreter_t` to be destroyed
-- it doesn't appear to be otherwise -- which does call `Py_Finalize`.
As expected this fixes the issue but can also crash due to the boost
issue mentioned above:
$ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg
<class 'bool'> True
[...]
Segmentation fault (core dumped)
$ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg | cat
<class 'bool'> True
[...]
$
1. https://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/tutorial/tutorial/embedding.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was regressed in 139beba which set `PYTHONUNBUFFERED` to fix other
test issues. When setting multiple environment variables in this way
they need to be delimited with semicolons rather than spaces. As it is
`PYTHONUNBUFFERED` is being set to `1 TZ=America/Chicago`. The CMake docs
are not as clear about this as they probably should be.
This can be verified by throwing together a CTestTestfile.cmake:
add_test(incorrect_env "printenv" "PYTHONUNBUFFERED" "TZ")
set_tests_properties(incorrect_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=America/Chicago")
add_test(correct_env "printenv" "PYTHONUNBUFFERED" "TZ")
set_tests_properties(correct_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=America/Chicago")
When run with `ctest -V`:
1: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ"
1: Environment variables:
1: PYTHONUNBUFFERED=1 TZ=America/Chicago
1: Test timeout computed to be: 10000000
1: 1 TZ=America/Chicago
1/2 Test #1: incorrect_env ....................***Failed 0.00 sec
test 2
Start 2: correct_env
2: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ"
2: Environment variables:
2: PYTHONUNBUFFERED=1
2: TZ=America/Chicago
2: Test timeout computed to be: 10000000
2: 1
2: America/Chicago
2/2 Test #2: correct_env ...................... Passed 0.00 sec
|
|
|
|
|
|
|
|
|
|
|
| |
python3 has buffered output by default, hence testcase option_py
returned no output when executed under test harness. I think this is a
real problem in the way python interpreter is embeded, and i.e. stdout
is not flushed until after test case has died. However, running things
unbuffered seems to make everything work.
But for some reason I had to adjust 1057.test slightly. I have no idea
what those numbers mean, and if running things unbuffered break stuff.
|
| |
|
|
|
|
|
|
| |
The set_target_properties() commands themselves do not cause the tests
to run if the target check is made, and as the target check executes
ctest, all tests will be run anyway.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Appveyor is a continuous integration platform for Windows that is free for open source projects. See latest test build here: https://ci.appveyor.com/project/Evan/ledger/build/artifacts
* Changed WIN32 to _WIN32 because this article http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system claims that it is defined by the greatest number of compilers.
* Modified HAVE_ISATTY and other system defines so that system.hh compiles when cmake fails to find the relevant function.
* Add missing include in test/unit/t_value.cc
Almost all tests fail when you run them on msys32. I will address that in a future PR.
|
|
|
|
|
|
| |
warning: equality comparison result unused [-Wunused-comparison]
BOOST_CHECK_THROW(v8 == v10, value_error);
~~~^~~~~~
|
|
|
|
| |
due to timezone settings.
|
|
|
|
| |
so that the tests run with a consistent environment.
|
|\ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
warning: relational comparison result unused [-Wunused-comparison]
BOOST_CHECK_THROW(x6 < x7, amount_error);
~~~^~~~
|
| |
| |
| |
| | |
by explicitly linking the testing targets against Python
|
|/ |
|
|
|
|
|
|
| |
Getting different output on system than travis-ci.
This reverts commit 272e3cb3799937dcd3c379de56b299a3cbde52ca.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|