Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balance assertions are not checked (BZ#1132) #1132

Closed
tbm opened this issue Aug 16, 2015 · 5 comments
Closed

Balance assertions are not checked (BZ#1132) #1132

tbm opened this issue Aug 16, 2015 · 5 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists P3 Average priority

Comments

@tbm
Copy link
Contributor

tbm commented Aug 16, 2015

Note: the issue was created automatically with bugzilla2github

Bugzilla bug ID: BZ#1132
From: Thierry (@thdox)

@tbm
Copy link
Contributor Author

tbm commented Aug 16, 2015

Comment author: Thierry (@thdox)

Created attachment 119
test file

If I launch reg on attached file, I got, for date near 2009/07/31:

--------------------8<--------------------8<--------------------8<----------
$ ledger --args-only --decimal-comma --file /tmp/thierry.hledger.AIA --no-pager reg Actif:Invest:Broker
09-Jun-30 Broker Actif:Invest:Broker 0,01 $ 340,16 $
09-Jun-30 Dividende Actif:Invest:Broker 66,50 $ 406,66 $
09-Jul-31 Broker Actif:Invest:Broker 0,02 $ 406,68 $
--------------------8<--------------------8<--------------------8<----------

But in my file, I have the following transaction:

--------------------8<--------------------8<--------------------8<----------
2009/07/31 * Broker
Actif:Invest:Broker 0,02 $ = 406,66 $
Revenu:Invest:Intérêt -0,02 $
Revenu:Devise -0,02 $
Revenu:Devise 0,02 $
--------------------8<--------------------8<--------------------8<----------

As we can see, the "reg" command is giving the correct math computed result, that is 406,68. The expected syntax error, is that it should have failed saying that on 2009/07/31, balance should be 406,68. In my file I have 406,66 that is not correct.

So ledger does not check the balance assertions in this use case.
I have found this use case, while using hledger 0.25, that is correctly catching the balance mismatch.

Attached file: test_32.ledger (application/octet-stream, 8198 bytes)
Description: test file

@tbm
Copy link
Contributor Author

tbm commented Aug 16, 2015

Comment author: Thierry (@thdox)

ledger command is actually this one (with correct filename):

ledger --args-only --decimal-comma --file test_32.ledger --columns=72 --no-pager reg Actif:Invest:Broker

@tbm
Copy link
Contributor Author

tbm commented Aug 16, 2015

Comment author: Thierry (@thdox)

Created attachment 120
another test file

I attach another test file, even simpler, where the balance assertion is not checked.

The command is:

ledger --args-only --decimal-comma --file test_32_1.ledger --columns=72 --no-pager reg Autre

But this should fail, as expected balance on first transaction is -126 (not 0).

Attached file: test_32_1.ledger (application/octet-stream, 262 bytes)
Description: another test file

@tbm tbm closed this as completed Nov 1, 2016
@tbm tbm added P3 Average priority bug Something isn't working duplicate This issue or pull request already exists labels May 18, 2018
@tbm
Copy link
Contributor Author

tbm commented Jun 1, 2018

Probably solved by pull request #451,

@tbm
Copy link
Contributor Author

tbm commented Jun 1, 2018

Duplicate of issue #1147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists P3 Average priority
Projects
None yet
Development

No branches or pull requests

1 participant