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:
parent
1288786fdc
commit
6a43de789f
1 changed files with 2 additions and 5 deletions
|
@ -331,12 +331,9 @@ test "floor division operator compound assignment", ->
|
||||||
|
|
||||||
test "modulo operator", ->
|
test "modulo operator", ->
|
||||||
check = (a, b, expected) ->
|
check = (a, b, expected) ->
|
||||||
res = a %% b
|
eq expected, a %% b, "expected #{a} %%%% #{b} to be #{expected}"
|
||||||
# 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}"
|
|
||||||
check 0, 1, 0
|
check 0, 1, 0
|
||||||
check 0, -1, 0
|
check 0, -1, -0
|
||||||
check 1, 0, NaN
|
check 1, 0, NaN
|
||||||
check 1, 2, 1
|
check 1, 2, 1
|
||||||
check 1, -2, -1
|
check 1, -2, -1
|
||||||
|
|
Loading…
Add table
Reference in a new issue