queries: treat amt:>0 like amt:>+0

Similar to the special case for amt:<0, for convenience.
To test that the absolute quantity is greater than 0, ie that the
quantity is non-zero, use not:amt:0.
This commit is contained in:
Simon Michael 2014-04-27 23:59:11 -07:00
parent aee7b3512d
commit 084bf8fea8

View File

@ -293,7 +293,8 @@ parseAmountQueryTerm s' =
'-':s -> (Eq, negate $ readDef err s)
'<':s -> let n = readDef err s in case n of 0 -> (Lt, 0)
_ -> (AbsLt, n)
'>':s -> (AbsGt, readDef err s)
'>':s -> let n = readDef err s in case n of 0 -> (Gt, 0)
_ -> (AbsGt, n)
'=':s -> (AbsEq, readDef err s)
s -> (AbsEq, readDef err s)
where
@ -302,7 +303,8 @@ parseAmountQueryTerm s' =
tests_parseAmountQueryTerm = [
"parseAmountQueryTerm" ~: do
let s `gives` r = parseAmountQueryTerm s `is` r
"<0" `gives` (Lt,0) -- special case, AbsLt 0 would be always false
"<0" `gives` (Lt,0) -- special case for convenience, since AbsLt 0 would be always false
">0" `gives` (Gt,0) -- special case for convenience and consistency with above
">10000.10" `gives` (AbsGt,10000.1)
"=0.23" `gives` (AbsEq,0.23)
"0.23" `gives` (AbsEq,0.23)