fish-shell/tests/math.in
Fabian Homborg 2d08b5ee8a [math] Add tests for runtime errors
And fix "isinfinite" - it's called "isinf".
2018-03-07 18:13:26 +01:00

36 lines
568 B
Fish

logmsg Validate basic expressions
math 3 / 2
math 10/6
math -s0 10 / 6
math -s3 10/6
math '10 % 6'
math -s0 '10 % 6'
math '23 % 7'
math --scale=6 '5 / 3 * 0.3'
math "7^2"
math -1 + 1
math '-2 * -2'
math 5 \* -2
math -- -4 / 2
math -- '-4 * 2'
logmsg Validate how variables in an expression are handled
math $x + 1
set x 1
math $x + 1
set x 3
set y 1.5
math "-$x * $y"
math -s1 "-$x * $y"
logmsg Validate math error reporting
not math '2 - '
not math 'ncr(1)'
not math 'max()'
not math 'sin()'
not math '2 + 2 4'
not math
not math -s 12
not math 2^650
not math 1 / 0