1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Simplify modulo tests

This commit is contained in:
Demian Ferreiro 2014-01-24 17:55:50 -03:00
parent 1288786fdc
commit 6a43de789f

View file

@ -331,12 +331,9 @@ test "floor division operator compound assignment", ->
test "modulo operator", ->
check = (a, b, expected) ->
res = a %% b
# Don't use eq because it treats 0 as different to -0.
ok res == expected or isNaN(res) and isNaN(expected),
"expected #{a} %%%% #{b} to be #{expected}"
eq expected, a %% b, "expected #{a} %%%% #{b} to be #{expected}"
check 0, 1, 0
check 0, -1, 0
check 0, -1, -0
check 1, 0, NaN
check 1, 2, 1
check 1, -2, -1