111 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # http://code.google.com/p/hledger/issues/detail?id=23
 | |
| #
 | |
| # 1. 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
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # 2. and here the price should be printed with its original precision, not
 | |
| # the canonical display precision
 | |
| bin/hledger -f - print
 | |
| <<<
 | |
| 2010/1/1
 | |
|    a  $0.00
 | |
|    a  1C @ $1.0049
 | |
|    a
 | |
| >>>
 | |
| 2010/01/01
 | |
|     a             0
 | |
|     a  1C @ $1.0049
 | |
|     a  -1C @ $1.0049
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # 3. with $'s display precision at 3 or more, this txn should not balance.
 | |
| # The error message shows the difference with full precision.
 | |
| bin/hledger -f - balance --no-total --cost --empty
 | |
| <<<
 | |
| 2010/1/1
 | |
|    a  1C @ $1.0049
 | |
|    a  $-1.000
 | |
| >>>2 /off by \$0.0049/
 | |
| >>>= 1
 | |
| 
 | |
| # 4. 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  a
 | |
| >>>=0
 | |
| 
 | |
| # 5. avamk's 2011/1/19 example
 | |
| bin/hledger -f - balance --cost
 | |
| <<<
 | |
| 2001/01/01 * ACME fund
 | |
|            assets:investment:ACME     203.890 ACME @ $16.02
 | |
|            equity:opening balances
 | |
| >>>
 | |
|             $3266.32  assets:investment:ACME
 | |
|            $-3266.32  equity:opening balances
 | |
| --------------------
 | |
|                    0
 | |
| >>>=0
 | |
| # hledger 0.14pre: precision=2, presumably from price
 | |
| #            $3266.32  assets:investment:ACME
 | |
| #           $-3266.32  equity:opening balances
 | |
| #--------------------
 | |
| #               $0.00
 | |
| #
 | |
| # ledger "2.6.0.90" with -s: full precision, ignores price
 | |
| #          $3266.3178  assets:investment:ACME
 | |
| #         $-3266.3178  equity:opening balances
 | |
| #
 | |
| # ledger 3: precision=0, uses default, ignores price
 | |
| #               $3266  assets:investment:ACME
 | |
| #              $-3266  equity:opening balances
 | |
| #--------------------
 | |
| #                   0
 | |
| ## 6. with a default commodity.. XXX should observe it
 | |
| 
 | |
|  bin/hledger -f - balance --cost
 | |
| <<<
 | |
| D $1000.0
 | |
| 2001/01/01 * ACME fund
 | |
|            assets:investment:ACME     203.890 ACME @ $16.02
 | |
|            equity:opening balances
 | |
| >>>
 | |
|             $3266.32  assets:investment:ACME
 | |
|            $-3266.32  equity:opening balances
 | |
| --------------------
 | |
|                    0
 | |
| >>>=0
 | |
| ### hledger 0.14pre: precision=2, presumably from price, ignores D
 | |
| ###            $3266.32  assets:investment:ACME
 | |
| ###           $-3266.32  equity:opening balances
 | |
| ###--------------------
 | |
| ###               $0.00
 | |
| ###
 | |
| ### ledger "2.6.0.90" with -s: full precision, ignores price and D
 | |
| ###          $3266.3178  assets:investment:ACME
 | |
| ###         $-3266.3178  equity:opening balances
 | |
| ###
 | |
| ### ledger 3: precision=1, ignores price, observes D
 | |
| ###             $3266.3  assets:investment:ACME
 | |
| ###            $-3266.3  equity:opening balances
 | |
| ###--------------------
 | |
| ###                   0
 |