forked from Mirror/wren
Add .isInfinity and .isInteger to Num.
This commit is contained in:
3
test/core/number/is_infinity.wren
Normal file
3
test/core/number/is_infinity.wren
Normal file
@ -0,0 +1,3 @@
|
||||
System.print(123.isInfinity) // expect: false
|
||||
System.print((1/0).isInfinity) // expect: true
|
||||
System.print((-10/0).isInfinity) // expect: true
|
||||
11
test/core/number/is_integer.wren
Normal file
11
test/core/number/is_integer.wren
Normal file
@ -0,0 +1,11 @@
|
||||
System.print(123.isInteger) // expect: true
|
||||
System.print(123.0.isInteger) // expect: true
|
||||
System.print(0.isInteger) // expect: true
|
||||
System.print(1.0000001.isInteger) // expect: false
|
||||
System.print((-2.3).isInteger) // expect: false
|
||||
|
||||
// NaN is not an integer.
|
||||
System.print((0/0).isInteger) // expect: false
|
||||
|
||||
// Infinity is not an integer.
|
||||
System.print((1/0).isInteger) // expect: false
|
||||
Reference in New Issue
Block a user