diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch08/8.5 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch08/8.5')
21 files changed, 493 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch08/8.5/8.5.1.js b/js/src/tests/test262/ch08/8.5/8.5.1.js new file mode 100644 index 000000000..076eebfba --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/8.5.1.js @@ -0,0 +1,64 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved. +/// Ecma International makes this code available under the terms and conditions set +/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +/// "Use Terms"). Any redistribution of this code must retain the above +/// copyright and this notice and otherwise comply with the Use Terms. +/** + * @path ch08/8.5/8.5.1.js + * @description Valid Number ranges + */ + +// Check range support for Number values (IEEE 754 64-bit floats having the form s*m*2**e) +// +// For normalized floats, sign (s) is +1 or -1, m (mantisa) is a positive integer less +// than 2**53 but not less than 2**52 and e (exponent) is an integer ranging from -1074 to 971 +// +// For denormalized floats, s is +1 or -1, m is a positive integer less than 2**52, and +// e is -1074 +// +// Below 64-bit float values shown for informational purposes. Values may be positive or negative. +// Infinity >= ~1.797693134862315907729305190789e+308 >= 2**1024 +// MAX_NORM = ~1.797693134862315708145274237317e+308 = (2**53 - 1) * (2**-52) * (2**1023) = (2**53-1) * (2**971) = (2**1024) - (2**971) +// MIN_NORM = ~2.2250738585072013830902327173324e-308 = 2**-1022 +// MAX_DENORM = ~2.2250738585072008890245868760859e-308 = MIN_NORM - MIN_DENORM = (2**-1022) - (2**-1074) +// MIN_DENORM = ~4.9406564584124654417656879286822e-324 = 2**-1074 + +// Fill an array with 2 to the power of (0 ... -1075) +var value = 1; +var floatValues = new Array(1076); +for(var power = 0; power <= 1075; power++){ + floatValues[power] = value; + // Use basic math operations for testing, which are required to support 'gradual underflow' rather + // than Math.pow etc..., which are defined as 'implementation dependent'. + value = value * 0.5; +} + +// The last value is below min denorm and should round to 0, everything else should contain a value +if(floatValues[1075] !== 0) { + $ERROR("Value after min denorm should round to 0"); +} + +// Validate the last actual value is min denorm +if(floatValues[1074] !== 4.9406564584124654417656879286822e-324) { + $ERROR("Min denorm value is incorrect: " + floatValues[1074]); +} + +// Validate that every value is half the value before it up to 1 +for(var index = 1074; index > 0; index--){ + if(floatValues[index] === 0){ + $ERROR("2**-" + index + " should not be 0"); + } + if(floatValues[index - 1] !== (floatValues[index] * 2)){ + $ERROR("Value should be double adjacent value at index " + index); + } +} + +// Max norm should be supported and compare less than inifity +if(!(1.797693134862315708145274237317e+308 < Infinity)){ + $ERROR("Max Number value 1.797693134862315708145274237317e+308 should not overflow to infinity"); +} + +// Numbers closer to 2**1024 then max norm should overflow to infinity +if(!(1.797693134862315808e+308 === +Infinity)){ + $ERROR("1.797693134862315808e+308 did not resolve to Infinity"); +} diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A1.js b/js/src/tests/test262/ch08/8.5/S8.5_A1.js new file mode 100644 index 000000000..23a14a325 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * NaN !== NaN + * + * @path ch08/8.5/S8.5_A1.js + * @description Compare NaN with NaN + */ + +var x = Number.NaN; +var x_ = Number.NaN; + +/////////////////////////////////////////////////////// +// CHECK #1 +if (x === x_){ + $ERROR('#1: NaN !== NaN '); +} +// +////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A10.js b/js/src/tests/test262/ch08/8.5/S8.5_A10.js new file mode 100644 index 000000000..436c920c5 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A10.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Infinity is not a keyword + * + * @path ch08/8.5/S8.5_A10.js + * @description Create variable entitled Infinity + */ + +var Infinity=1.0; +Infinity='asdf'; +Infinity=true; + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A11_T1.js b/js/src/tests/test262/ch08/8.5/S8.5_A11_T1.js new file mode 100644 index 000000000..e298d32ea --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A11_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The integer 0 has two representations, +0 and -0 + * + * @path ch08/8.5/S8.5_A11_T1.js + * @description Check 1.0/p_zero !== 1.0/n_zero + */ + +var p_zero=+0; +var n_zero=-0; + +if (1.0/p_zero === 1.0/n_zero){ + $ERROR('#1: var p_zero=+0; var n_zero=-0; 1.0/p_zero !== 1.0/n_zero'); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A11_T2.js b/js/src/tests/test262/ch08/8.5/S8.5_A11_T2.js new file mode 100644 index 000000000..122c345ed --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A11_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The integer 0 has two representations, +0 and -0 + * + * @path ch08/8.5/S8.5_A11_T2.js + * @description Compare positive_zero and negative_zero + */ + +var p_zero=+0; +var n_zero=-0; + +//CHECK #1 +if ((p_zero == n_zero) !== true){ + $ERROR('#1: var p_zero=+0; var n_zero=-0; p_zero != n_zero'); +} + +//CHECK #2 +if ((n_zero == 0) !== true){ + $ERROR('#2: var p_zero=+0; var n_zero=-0; n_zero == 0'); +} + +//CHECK #3 +if ((p_zero == -0) !== true){ + $ERROR('#3: var p_zero=+0; var n_zero=-0; p_zero == -0'); +} + +//CHECK #4 +if ((p_zero === 0) !== true){ + $ERROR('#4: var p_zero=+0; var n_zero=-0; p_zero === 0'); +} + +//CHECK #5 +if ((n_zero === -0) !== true){ + $ERROR('#5: var p_zero=+0; var n_zero=-0; n_zero === -0'); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A12.1.js b/js/src/tests/test262/ch08/8.5/S8.5_A12.1.js new file mode 100644 index 000000000..846aab24d --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A12.1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * +Infinity and Infinity are the same as Number.POSITIVE_INFINITY + * + * @path ch08/8.5/S8.5_A12.1.js + * @description Compare Infinity and +Infinity with Number.POSITIVE_INFINITY + */ + +var p_inf=+Infinity; +var inf=Infinity; + +//CHECK #1 +if (p_inf!==Number.POSITIVE_INFINITY){ + $ERROR('#1: +Infinity is the same as Number.POSITIVE_INFINITY'); +} + +//CHECK #2 +if (inf!==Number.POSITIVE_INFINITY){ + $ERROR('#2: Infinity is the same as Number.POSITIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A12.2.js b/js/src/tests/test262/ch08/8.5/S8.5_A12.2.js new file mode 100644 index 000000000..e1397ed1d --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A12.2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * -Infinity is the same as Number.NEGATIVE_INFINITY + * + * @path ch08/8.5/S8.5_A12.2.js + * @description Compare -Infinity with Number.NEGATIVE_INFINITY + */ + +var n_inf=-Infinity; + +//CHECK #1 +if (n_inf !== Number.NEGATIVE_INFINITY){ + $ERROR('#1: -Infinity is the same as Number.NEGATIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A13_T2.js b/js/src/tests/test262/ch08/8.5/S8.5_A13_T2.js new file mode 100644 index 000000000..ef7e2a5ca --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A13_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Finite nonzero values that are Normalised having the form s*m*2**e + * where s is +1 or -1, m is a positive integer less than 2**53 but not + * less than s**52 and e is an integer ranging from -1074 to 971 + * + * @path ch08/8.5/S8.5_A13_T2.js + * @description Finite Non zero values where e is 971 + */ + +//CHECK #1 +if ((1*(Math.pow(2,52))*(Math.pow(2,971))) !== 8.98846567431158e+307){ + $ERROR('#1: (1*(Math.pow(2,52))*(Math.pow(2,971))) === 8.98846567431158e+307. Actual: ' + ((1*(Math.pow(2,52))*(Math.pow(2,971))))); +} + +//CHECK #2 +if ((1*((Math.pow(2,53))-1)*(Math.pow(2,971))) !== 1.7976931348623157e+308){ + $ERROR('#2: (1*((Math.pow(2,53))-1)*(Math.pow(2,971))) === 1.7976931348623157e+308. Actual: ' + ((1*((Math.pow(2,53))-1)*(Math.pow(2,971))))); +} + +//CHECK #3 +if ((-1*(Math.pow(2,52))*(Math.pow(2,971))) !== -8.98846567431158e+307){ + $ERROR('#3: (-1*(Math.pow(2,52))*(Math.pow(2,971))) === -8.98846567431158e+307. Actual: ' + ((-1*(Math.pow(2,52))*(Math.pow(2,971))))); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A14_T1.js b/js/src/tests/test262/ch08/8.5/S8.5_A14_T1.js new file mode 100644 index 000000000..0b5e87b3e --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A14_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When number absolute value is bigger of 2**1024 should convert to Infinity + * + * @path ch08/8.5/S8.5_A14_T1.js + * @description Create number bigger of 2**1024 + */ + +//CHECK #1 +if (1e+308*2 !== Infinity){ + $ERROR('#1: 1e+308*2 === Infinity. Actual: ' + (1e+308*2)); +} + +//CHECK #2 +if ((1*(Math.pow(2,53))*(Math.pow(2,971))) !== Infinity){ + $ERROR('#2: (1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((1*(Math.pow(2,53))*(Math.pow(2,971))))); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A14_T2.js b/js/src/tests/test262/ch08/8.5/S8.5_A14_T2.js new file mode 100644 index 000000000..37dc8cd5f --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A14_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When number absolute value is bigger of 2**1024 should convert to Infinity + * + * @path ch08/8.5/S8.5_A14_T2.js + * @description Create number smaller of -2**1024 + */ + +//CHECK #1 +if (-1e+308*3 !== -Infinity){ + $ERROR('#1: -1e+308*3 === Infinity. Actual: ' + (-1e+308*3)); +} + +//CHECK #2 +if ((-1*(Math.pow(2,53))*(Math.pow(2,971))) !== -Infinity){ + $ERROR('#2: (-1*(Math.pow(2,53))*(Math.pow(2,971))) === Infinity. Actual: ' + ((-1*(Math.pow(2,53))*(Math.pow(2,971))))); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A2.1.js b/js/src/tests/test262/ch08/8.5/S8.5_A2.1.js new file mode 100644 index 000000000..0baca20f9 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A2.1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Number type represented as the double precision 64-bit format IEEE 754 + * + * @path ch08/8.5/S8.5_A2.1.js + * @description Use 2^53 + 2 number and do some operation with it + */ + +var x = 9007199254740994.0; /* 2^53 + 2 */ +var y = 1.0 - 1/65536.0; +var z = x + y; +var d = z - x; + +if (d !== 0){ + $ERROR('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d === 0. Actual: ' + (d)); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A2.2.js b/js/src/tests/test262/ch08/8.5/S8.5_A2.2.js new file mode 100644 index 000000000..eec062201 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A2.2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Number type represented as the extended precision 64-bit format IEEE 754 + * + * @path ch08/8.5/S8.5_A2.2.js + * @description Use 2^53 + 2 number and do some operation with it + */ + +var x = 9007199254740994.0; /* 2^53 + 2 */ +var y = 1.0 - 1/65536.0; +var z = x + y; +var d = z - x; + +if (d === 2){ + $ERROR('#1: var x = 9007199254740994.0; var y = 1.0 - 1/65536.0; var z = x + y; var d = z - x; d !== 2'); +} + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A3.js b/js/src/tests/test262/ch08/8.5/S8.5_A3.js new file mode 100644 index 000000000..89f1299a6 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * NaN expression has a type Number + * + * @path ch08/8.5/S8.5_A3.js + * @description Check type of NaN + */ + +var x=NaN; + +/////////////////////////////////////////////////////// +// CHECK#1 +if (typeof(x) !== "number"){ + $ERROR('#1: var x=NaN; typeof(x) === "number". Actual: ' + (typeof(x))); +} +// +////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// CHECK#2 +if (typeof(NaN) !== "number"){ + $ERROR('#2: typeof(NaN) === "number". Actual: ' + (typeof(NaN))); +} +// +////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A4.js b/js/src/tests/test262/ch08/8.5/S8.5_A4.js new file mode 100644 index 000000000..b54f8dbef --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * NaN is not a keyword + * + * @path ch08/8.5/S8.5_A4.js + * @description Create variable entitled NaN + */ + +var NaN=1.0; +NaN='asdf'; +NaN=true; +NaN=Number.NaN; + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A5.js b/js/src/tests/test262/ch08/8.5/S8.5_A5.js new file mode 100644 index 000000000..6587609c2 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A5.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * NaN not greater or equal zero + * + * @path ch08/8.5/S8.5_A5.js + * @description Compare NaN with zero + */ + +var x = NaN; +var x_geq_0=(x >= 0.0); +var x_leq_0=(x <= 0.0); +var x_leq_0_OR_geq_0=(x <= 0.0)||(x >= 0.0); +var x_geq_0_ADD_leq_0=(x >= 0.0) + (x <= 0.0); + + +/////////////////////////////////////////////////// +// CHECK#1 +if (x_geq_0){ + $ERROR('#1: NaN not greater or equal zero'); +} else { + $PRINT('#1: NaN not greater or equal zero'); +} +// +/////////////////////////////////////////////////// + +/////////////////////////////////////////////////// +// CHECK#2 +if (x_leq_0){ + $ERROR('#2: NaN not less or equal zero'); +} else { + $PRINT('#2: NaN not less or equal zero'); +} +// +/////////////////////////////////////////////////// + +/////////////////////////////////////////////////// +// CHECK#3 +if (x_leq_0_OR_geq_0){ + $ERROR('#3: NaN not less or equal zero OR greater or equal zero'); +} else { + $PRINT('#3: NaN not less or equal zero OR greater or equal zero'); +} +// +/////////////////////////////////////////////////// + +/////////////////////////////////////////////////// +// CHECK#4 +if (x_geq_0_ADD_leq_0){ + $ERROR('#4: NaN not less or equal zero ADD greater or equal zero'); +} else { + $PRINT('#4: NaN not less or equal zero ADD greater or equal zero'); +} +// +/////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A6.js b/js/src/tests/test262/ch08/8.5/S8.5_A6.js new file mode 100644 index 000000000..e621f7563 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A6.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * -Infinity expression has a type Number + * + * @path ch08/8.5/S8.5_A6.js + * @description Check type of -Infinity + */ + +var x=-Infinity; + +/////////////////////////////////////////////////////// +// CHECK#1 +if (typeof(x) !== "number"){ + $ERROR('#1: var x=-Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); +} +// +////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// CHECK#2 +if (typeof(-Infinity) !== "number"){ + $ERROR('#2: typeof(-Infinity) === "number". Actual: ' + (typeof(-Infinity))); +} +// +////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A7.js b/js/src/tests/test262/ch08/8.5/S8.5_A7.js new file mode 100644 index 000000000..0f17e85f0 --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A7.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * +Infinity expression has a type Number + * + * @path ch08/8.5/S8.5_A7.js + * @description Check type of +Infinity + */ + +var x=+Infinity; + +/////////////////////////////////////////////////////// +// CHECK#1 +if (typeof(x) !== "number"){ + $ERROR('#1: var x=+Infinity; typeof(x) === "number". Actual: ' + (typeof(x))); +} +// +////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// CHECK#2 +if (typeof(+Infinity) !== "number"){ + $ERROR('#2: typeof(+Infinity) === "number". Actual: ' + (typeof(+Infinity))); +} +// +////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A8.js b/js/src/tests/test262/ch08/8.5/S8.5_A8.js new file mode 100644 index 000000000..95c87824b --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A8.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Infinity is the same as +Infinity + * + * @path ch08/8.5/S8.5_A8.js + * @description Compare Infinity and +Infinity + */ + +var p_inf=+Infinity; +var inf=Infinity; + +/////////////////////////////////////////////////////// +// +if (p_inf!==inf){ + $ERROR('#1: Infinity is the same as +Infinity'); +} +// +////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.5/S8.5_A9.js b/js/src/tests/test262/ch08/8.5/S8.5_A9.js new file mode 100644 index 000000000..ff783d50f --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/S8.5_A9.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Globally defined variable NaN has not been altered by program execution + * + * @path ch08/8.5/S8.5_A9.js + * @description Try alter globally defined variable NaN + * @noStrict + */ + +Number.NaN = 1; + +if (Number.NaN === 1) { + $ERROR('#1: Globally defined variable NaN has not been altered by program execution'); +} + diff --git a/js/src/tests/test262/ch08/8.5/browser.js b/js/src/tests/test262/ch08/8.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/browser.js diff --git a/js/src/tests/test262/ch08/8.5/shell.js b/js/src/tests/test262/ch08/8.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.5/shell.js |