diff --git a/hledger/test/journal/precision.test b/hledger/test/journal/precision.test index 518f7b628..c5f6ef7d6 100644 --- a/hledger/test/journal/precision.test +++ b/hledger/test/journal/precision.test @@ -189,7 +189,7 @@ $ hledger -f - bal -O csv "c","1000 JPY" "Total:","1002 JPY" -# ** 13. An entry like this, generated by bean-report, did not balance in hledger <=1.43, +# ** 13. Before hledger 1.44, an entry like this (generated by bean-report) did not balance, # because the P amount influenced the commodity's display (and balancing) precision. # From 1.44 transaction balancing uses the transaction's local precisions, # so CNY's precision is 2 and this does balance. @@ -202,22 +202,12 @@ P 2025-01-01 USD 7.147224669603524229074889868 CNY $ hledger -f - check -# ** 14. Note that although cost amounts don't influence display precision, P amounts do, currently. +# ** 14. Note that P amounts do influence display precision, currently. $ hledger -f - bal -N 811.210000000000000000000000000 CNY -113.50 USD a -# ** 15. Without the P directive, the posting amount's precision is used (2 digits). -< -2025-01-01 - a -113.50 USD @ 7.147224669603524229074889868 CNY - a 811.21 CNY - -$ hledger -f - bal -N - 811.21 CNY - -113.50 USD a - -# ** 16. Inferred posting amounts can also influence display precision. +# ** 15. And inferred posting amounts can also influence display precision. < 2025-01-01 a -113.50 USD @ 7.147224669603524229074889868 CNY @@ -228,3 +218,18 @@ $ hledger -f - bal -N 811.210000000000000000000000000 CNY -113.50 USD a 0.000000000000000000000000018 CNY z + +# ** 16. Before hledger 1.44, an inexactly balanced entry like this could be accepted +# because of a commodity directive reducing the display/balance-checking precision. +# From 1.44, transaction balancing uses the transaction's local precisions only, +# making the balance checking more strict in this case. +< +commodity $1.00 + +2025-01-01 + a 1 C @ $1.1206 + a -$1.120 + +$ hledger -f - check +>2 /unbalanced/ +>= 1