lib: update old failing amountp/postingp tests, at last (#812)
This commit is contained in:
		
							parent
							
								
									dab75d98c8
								
							
						
					
					
						commit
						e9c5d13ac1
					
				| @ -1248,7 +1248,31 @@ easytests = scope "Common" $ tests [ | ||||
|   scope "amountp" $ tests [ | ||||
|     scope "basic"                  $ expectParseEq amountp "$47.18"     (usd 47.18) | ||||
|    ,scope "ends-with-decimal-mark" $ expectParseEq amountp "$1."        (usd 1  `withPrecision` 0) | ||||
| --   ,scope "unit-price"        $ expectParseEq amountp "$10 @ €0.5" (usd 10 `withPrecision` 0 `at` (eur 0.5 `withPrecision` 1))  | ||||
| --   ,scope "total-price"       $ expectParseEq amountp "$10 @@ €5"  (usd 10 `withPrecision` 0 @@ (eur 5 `withPrecision` 0)) | ||||
|    ,scope "unit-price"        $ expectParseEq amountp "$10 @ €0.5"  | ||||
|       -- not precise enough: | ||||
|       -- (usd 10 `withPrecision` 0 `at` (eur 0.5 `withPrecision` 1)) -- `withStyle` asdecimalpoint=Just '.' | ||||
|       amount{ | ||||
|          acommodity="$" | ||||
|         ,aquantity=10 -- need to test internal precision with roundTo ? I think not  | ||||
|         ,astyle=amountstyle{asprecision=0, asdecimalpoint=Nothing} | ||||
|         ,aprice=UnitPrice $ | ||||
|           amount{ | ||||
|              acommodity="€" | ||||
|             ,aquantity=0.5 | ||||
|             ,astyle=amountstyle{asprecision=1, asdecimalpoint=Just '.'} | ||||
|             }  | ||||
|         }  | ||||
|    ,scope "total-price"       $ expectParseEq amountp "$10 @@ €5" | ||||
|       amount{ | ||||
|          acommodity="$" | ||||
|         ,aquantity=10  | ||||
|         ,astyle=amountstyle{asprecision=0, asdecimalpoint=Nothing} | ||||
|         ,aprice=TotalPrice $ | ||||
|           amount{ | ||||
|              acommodity="€" | ||||
|             ,aquantity=5 | ||||
|             ,astyle=amountstyle{asprecision=0, asdecimalpoint=Nothing} | ||||
|             }  | ||||
|         }  | ||||
|     ] | ||||
|   ] | ||||
|  | ||||
| @ -676,25 +676,26 @@ test_postingp = TestCase $ do | ||||
|                          same "status" pstatus | ||||
|                          same "account" paccount | ||||
|                          -- same "amount" pamount | ||||
| -- TODO                  assertEqual "Posting amount differs!" (showMixedAmountDebug $ pamount ep) (showMixedAmountDebug $ pamount ap) | ||||
|                          -- more revealing: | ||||
|                          assertEqual "amount differs!" (showMixedAmountDebug $ pamount ep) (showMixedAmountDebug $ pamount ap) | ||||
|                          same "comment" pcomment | ||||
|                          same "type" ptype | ||||
|                          same "tags" ptags | ||||
|                          same "transaction" ptransaction | ||||
|     "  expenses:food:dining  $10.00   ; a: a a \n   ; b: b b \n" `gives` | ||||
|       posting{paccount="expenses:food:dining", pamount=Mixed [usd 10], pcomment="a: a a\nb: b b\n", ptags=[("a","a a"), ("b","b b")]} | ||||
| 
 | ||||
|     " a  1 ; [2012/11/28]\n" `gives` | ||||
|      | ||||
|     " a  1. ; [2012/11/28]\n" `gives`  -- trailing decimal point required to match num's asdecimalpoint | ||||
|       ("a" `post` num 1){pcomment="[2012/11/28]\n" | ||||
|                         ,pdate=parsedateM "2012/11/28"} | ||||
| 
 | ||||
|     " a  1 ; a:a, [=2012/11/28]\n" `gives` | ||||
|       ("a" `post` num 1){pcomment="a:a, [=2012/11/28]\n" | ||||
|     " a  2. ; a:a, [=2012/11/28]\n" `gives` | ||||
|       ("a" `post` num 2){pcomment="a:a, [=2012/11/28]\n" | ||||
|                         ,ptags=[("a","a")] | ||||
|                         ,pdate=Nothing} | ||||
| 
 | ||||
|     " a  1 ; a:a\n  ; [2012/11/28=2012/11/29],b:b\n" `gives` | ||||
|       ("a" `post` num 1){pcomment="a:a\n[2012/11/28=2012/11/29],b:b\n" | ||||
|     " a  3. ; a:a\n  ; [2012/11/28=2012/11/29],b:b\n" `gives` | ||||
|       ("a" `post` num 3){pcomment="a:a\n[2012/11/28=2012/11/29],b:b\n" | ||||
|                         ,ptags=[("a","a"), ("[2012/11/28=2012/11/29],b","b")] -- XXX ugly tag name parsed | ||||
|                         ,pdate=parsedateM "2012/11/28"} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user