From b698c8b3ab2980cc1282cb08796d0b76337bf7d9 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 14 Mar 2016 10:23:26 -0400 Subject: [PATCH] Add tests for Math constants Closes gh-540 Because the specific value of each constant is specified as a host-defined approximation, only the value type may be enforced by Test262. --- test/built-ins/Math/E/value.js | 15 +++++++++++++++ test/built-ins/Math/LN10/value.js | 15 +++++++++++++++ test/built-ins/Math/LN2/value.js | 15 +++++++++++++++ test/built-ins/Math/LOG10E/value.js | 15 +++++++++++++++ test/built-ins/Math/LOG2E/value.js | 15 +++++++++++++++ test/built-ins/Math/PI/value.js | 15 +++++++++++++++ test/built-ins/Math/SQRT1_2/value.js | 15 +++++++++++++++ test/built-ins/Math/SQRT2/value.js | 15 +++++++++++++++ 8 files changed, 120 insertions(+) create mode 100644 test/built-ins/Math/E/value.js create mode 100644 test/built-ins/Math/LN10/value.js create mode 100644 test/built-ins/Math/LN2/value.js create mode 100644 test/built-ins/Math/LOG10E/value.js create mode 100644 test/built-ins/Math/LOG2E/value.js create mode 100644 test/built-ins/Math/PI/value.js create mode 100644 test/built-ins/Math/SQRT1_2/value.js create mode 100644 test/built-ins/Math/SQRT2/value.js diff --git a/test/built-ins/Math/E/value.js b/test/built-ins/Math/E/value.js new file mode 100644 index 0000000000..5654aa34dd --- /dev/null +++ b/test/built-ins/Math/E/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.E is a numeric value +esid: sec-math.e +es6id: 20.2.1.1 +info: > + The Number value for e, the base of the natural logarithms, which is + approximately 2.7182818284590452354. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.E, 'number'); +assert.notSameValue(Math.E, NaN); diff --git a/test/built-ins/Math/LN10/value.js b/test/built-ins/Math/LN10/value.js new file mode 100644 index 0000000000..b379953d2d --- /dev/null +++ b/test/built-ins/Math/LN10/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.LN10 is a numeric value +esid: sec-math.ln10 +es6id: 20.2.1.2 +info: > + The Number value for the natural logarithm of 10, which is approximately + 2.302585092994046. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.LN10, 'number'); +assert.notSameValue(Math.LN10, NaN); diff --git a/test/built-ins/Math/LN2/value.js b/test/built-ins/Math/LN2/value.js new file mode 100644 index 0000000000..66cdcfc9c2 --- /dev/null +++ b/test/built-ins/Math/LN2/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.LN2 is a numeric value +esid: sec-math.ln2 +es6id: 20.2.1.3 +info: > + The Number value for the natural logarithm of 2, which is approximately + 0.6931471805599453. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.LN2, 'number'); +assert.notSameValue(Math.LN2, NaN); diff --git a/test/built-ins/Math/LOG10E/value.js b/test/built-ins/Math/LOG10E/value.js new file mode 100644 index 0000000000..64a95043f4 --- /dev/null +++ b/test/built-ins/Math/LOG10E/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.LOG10E is a numeric value +esid: sec-math.log10e +es6id: 20.2.1.4 +info: > + The Number value for the base-10 logarithm of e, the base of the natural + logarithms; this value is approximately 0.4342944819032518. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.LOG10E, 'number'); +assert.notSameValue(Math.LOG10E, NaN); diff --git a/test/built-ins/Math/LOG2E/value.js b/test/built-ins/Math/LOG2E/value.js new file mode 100644 index 0000000000..b4f5f70f45 --- /dev/null +++ b/test/built-ins/Math/LOG2E/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.LOG2E is a numeric value +esid: sec-math.log2e +es6id: 20.2.1.5 +info: > + The Number value for the base-2 logarithm of e, the base of the natural + logarithms; this value is approximately 1.4426950408889634. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.LOG2E, 'number'); +assert.notSameValue(Math.LOG2E, NaN); diff --git a/test/built-ins/Math/PI/value.js b/test/built-ins/Math/PI/value.js new file mode 100644 index 0000000000..d85749fd1a --- /dev/null +++ b/test/built-ins/Math/PI/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.PI is a numeric value +esid: sec-math.pi +es6id: 20.2.1.6 +info: > + The Number value for pi, the ratio of the circumference of a circle to its + diameter, which is approximately 3.1415926535897932. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.PI, 'number'); +assert.notSameValue(Math.PI, NaN); diff --git a/test/built-ins/Math/SQRT1_2/value.js b/test/built-ins/Math/SQRT1_2/value.js new file mode 100644 index 0000000000..b38174f2bc --- /dev/null +++ b/test/built-ins/Math/SQRT1_2/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.SQRT1_2 is a numeric value +esid: sec-math.sqrt1_2 +es6id: 20.2.1.7 +info: > + The Number value for the square root of `1/2`, which is approximately + 0.7071067811865476. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.SQRT1_2, 'number'); +assert.notSameValue(Math.SQRT1_2, NaN); diff --git a/test/built-ins/Math/SQRT2/value.js b/test/built-ins/Math/SQRT2/value.js new file mode 100644 index 0000000000..628ca9cf98 --- /dev/null +++ b/test/built-ins/Math/SQRT2/value.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Math.SQRT2 is a numeric value +esid: sec-math.sqrt2 +es6id: 20.2.1.8 +info: > + The Number value for the square root of 2, which is approximately + 1.4142135623730951. + + The precision of this approximation is host-defined. +---*/ + +assert.sameValue(typeof Math.SQRT2, 'number'); +assert.notSameValue(Math.SQRT2, NaN);