diff --git a/test/built-ins/Number/isFinite/arg-is-not-number.js b/test/built-ins/Number/isFinite/arg-is-not-number.js new file mode 100644 index 0000000000..f48ebd26be --- /dev/null +++ b/test/built-ins/Number/isFinite/arg-is-not-number.js @@ -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.2 +esid: sec-number.isfinite +description: > + Return false if argument is not Number +info: | + Number.isFinite ( number ) + + 1. If Type(number) is not Number, return false. + [...] +features: [Symbol] +---*/ + +assert.sameValue(Number.isFinite("1"), false, "string"); +assert.sameValue(Number.isFinite([1]), false, "[1]"); +assert.sameValue(Number.isFinite(new Number(42)), false, "Number object"); +assert.sameValue(Number.isFinite(false), false, "false"); +assert.sameValue(Number.isFinite(true), false, "true"); +assert.sameValue(Number.isFinite(undefined), false, "undefined"); +assert.sameValue(Number.isFinite(null), false, "null"); +assert.sameValue(Number.isFinite(Symbol("1")), false, "symbol"); +assert.sameValue(Number.isFinite(), false, "no arg"); diff --git a/test/built-ins/Number/isFinite/finite-numbers.js b/test/built-ins/Number/isFinite/finite-numbers.js new file mode 100644 index 0000000000..5731eaf25e --- /dev/null +++ b/test/built-ins/Number/isFinite/finite-numbers.js @@ -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.2 +esid: sec-number.isfinite +description: > + Return true for valid finite numbers +info: | + Number.isFinite ( number ) + + 1. If Type(number) is not Number, return false. + 2. If number is NaN, +∞, or -∞, return false. + 3. Otherwise, return true. +---*/ + +assert.sameValue(Number.isFinite(-10), true, "-10"); +assert.sameValue(Number.isFinite(-0), true, "-0"); +assert.sameValue(Number.isFinite(0), true, "0"); +assert.sameValue(Number.isFinite(10), true, "10"); +assert.sameValue(Number.isFinite(1e10), true, "1e10"); +assert.sameValue(Number.isFinite(10.10), true, "10.10"); +assert.sameValue(Number.isFinite(9007199254740991), true, "9007199254740991"); +assert.sameValue(Number.isFinite(-9007199254740991), true, "-9007199254740991"); +assert.sameValue(Number.isFinite(Number.MAX_VALUE), true, "Number.MAX_VALUE"); diff --git a/test/built-ins/Number/isFinite/infinity.js b/test/built-ins/Number/isFinite/infinity.js new file mode 100644 index 0000000000..18c869791a --- /dev/null +++ b/test/built-ins/Number/isFinite/infinity.js @@ -0,0 +1,18 @@ +// 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.2 +esid: sec-number.isfinite +description: > + Return false if argument is Infinity or -Infinity +info: | + Number.isFinite ( number ) + + [...] + 2. If number is NaN, +∞, or -∞, return false. + [...] +---*/ + +assert.sameValue(Number.isFinite(Infinity), false, "+Infinity"); +assert.sameValue(Number.isFinite(-Infinity), false, "-Infinity"); diff --git a/test/built-ins/Number/isFinite/nan.js b/test/built-ins/Number/isFinite/nan.js new file mode 100644 index 0000000000..8dc1831a42 --- /dev/null +++ b/test/built-ins/Number/isFinite/nan.js @@ -0,0 +1,17 @@ +// 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.2 +esid: sec-number.isfinite +description: > + Return false if argument is NaN +info: | + Number.isFinite ( number ) + + [...] + 2. If number is NaN, +∞, or -∞, return false. + [...] +---*/ + +assert.sameValue(Number.isFinite(NaN), false); diff --git a/test/built-ins/Number/isFinite/prop-desc.js b/test/built-ins/Number/isFinite/prop-desc.js new file mode 100644 index 0000000000..9e98013b23 --- /dev/null +++ b/test/built-ins/Number/isFinite/prop-desc.js @@ -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.2 +esid: sec-number.isfinite +description: > + "isFinite" 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, "isFinite"); +verifyWritable(Number, "isFinite"); +verifyConfigurable(Number, "isFinite");