hledger/tests/precision.test
Simon Michael 811e71aba7 price precisions don't influence display precision; balancing is based on display precision (#23)
Like ledger, price amounts are now "unobserved", ie their precision does
not affect the canonical display precisions used when displaying amounts,
and transaction balancing is done based on display precision, ie amounts
are considered to balance if their sum appears to be zero when using the
canonical display precision.
2010-11-14 22:44:37 +00:00

34 lines
715 B
Plaintext

# http://code.google.com/p/hledger/issues/detail?id=23
#
# with explicit price:
# prices' commodities are unobserved, so $'s display precision here should be 2 not 4
bin/hledger -f - print --cost
<<<
2010/1/1
a $0.00
a 1C @ $1.0049
a
>>>
2010/01/01
a 0
a $1.00
a $-1.00
>>>2
# with $'s display precision at 3 or more, this txn should not balance
bin/hledger -f - balance --no-total --cost --empty
<<<
2010/1/1
a 1C @ $1.0049
a $-1.000
>>>2 /off by \$0.005/
>>>= 1
# with $'s display precision at 2 or less, this txn should balance
bin/hledger -f - balance --no-total --cost --empty
<<<
2010/1/1
a 1C @ $1.0049
a $-1.00
>>>
$0.00 a