mirror of https://github.com/tc39/test262.git
Add tests for Number.isInteger
This commit is contained in:
parent
46d8c3d6b8
commit
c246bc7d09
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) 2014 Ryan Lewis. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
author: Ryan Lewis
|
||||
description: >
|
||||
Number.isInteger should return false if called with a string
|
||||
(non-Number)
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger('2'), false, 'Number.isInteger("2")');
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) 2014 Ryan Lewis. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
author: Ryan Lewis
|
||||
description: >
|
||||
Number.isInteger should return false if called with a string
|
||||
(non-Number)
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger('word'), false, 'Number.isInteger("word")');
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) 2014 Ryan Lewis. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
author: Ryan Lewis
|
||||
description: Number.isInteger should return true if called with an integer.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger(478), true, 'Number.isInteger(478)');
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
esid: sec-number.isinteger
|
||||
description: >
|
||||
Return false if argument is not Number
|
||||
info: |
|
||||
Number.isInteger ( number )
|
||||
|
||||
1. If Type(number) is not Number, return false.
|
||||
[...]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger("1"), false, "string");
|
||||
assert.sameValue(Number.isInteger([1]), false, "[1]");
|
||||
assert.sameValue(Number.isInteger(new Number(42)), false, "Number object");
|
||||
assert.sameValue(Number.isInteger(false), false, "false");
|
||||
assert.sameValue(Number.isInteger(true), false, "true");
|
||||
assert.sameValue(Number.isInteger(undefined), false, "undefined");
|
||||
assert.sameValue(Number.isInteger(null), false, "null");
|
||||
assert.sameValue(Number.isInteger(Symbol("1")), false, "symbol");
|
||||
assert.sameValue(Number.isInteger(), false, "no arg");
|
|
@ -7,4 +7,5 @@ author: Ryan Lewis
|
|||
description: Number.isInteger should return false if called with Infinity.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger(Infinity), false, 'Number.isInteger(Infinity)');
|
||||
assert.sameValue(Number.isInteger(Infinity), false, 'Infinity');
|
||||
assert.sameValue(Number.isInteger(-Infinity), false, '-Infinity');
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2014 Ryan Lewis. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
author: Ryan Lewis
|
||||
description: Number.isInteger should return true if called with an integer.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger(478), true, 'Number.isInteger(478)');
|
||||
assert.sameValue(Number.isInteger(-0), true, '-0');
|
||||
assert.sameValue(Number.isInteger(0), true, '0');
|
||||
assert.sameValue(Number.isInteger(-1), true, '-1');
|
||||
assert.sameValue(Number.isInteger(9007199254740991), true, '9007199254740991');
|
||||
assert.sameValue(Number.isInteger(-9007199254740991), true, '-9007199254740991');
|
||||
assert.sameValue(Number.isInteger(9007199254740992), true, '9007199254740992');
|
||||
assert.sameValue(Number.isInteger(-9007199254740992), true, '-9007199254740992');
|
|
@ -7,4 +7,7 @@ author: Ryan Lewis
|
|||
description: Number.isInteger should return false if called with a double.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isInteger(6.75), false, 'Number.isInteger(6.75)');
|
||||
assert.sameValue(Number.isInteger(6.75), false, '6.75');
|
||||
assert.sameValue(Number.isInteger(0.000001), false, '0.000001');
|
||||
assert.sameValue(Number.isInteger(-0.000001), false, '-0.000001');
|
||||
assert.sameValue(Number.isInteger(11e-1), false, '11e-1');
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 20.1.2.3
|
||||
esid: sec-number.isinteger
|
||||
description: >
|
||||
"isInteger" property of Number
|
||||
info: >
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(Number, "isInteger");
|
||||
verifyWritable(Number, "isInteger");
|
||||
verifyConfigurable(Number, "isInteger");
|
Loading…
Reference in New Issue