From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- js/src/tests/test262/built-ins/Math/E/browser.js | 0 js/src/tests/test262/built-ins/Math/E/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/E/shell.js | 0 js/src/tests/test262/built-ins/Math/E/value.js | 16 +++++ .../tests/test262/built-ins/Math/LN10/browser.js | 0 .../tests/test262/built-ins/Math/LN10/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/LN10/shell.js | 0 js/src/tests/test262/built-ins/Math/LN10/value.js | 16 +++++ js/src/tests/test262/built-ins/Math/LN2/browser.js | 0 .../tests/test262/built-ins/Math/LN2/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/LN2/shell.js | 0 js/src/tests/test262/built-ins/Math/LN2/value.js | 16 +++++ .../tests/test262/built-ins/Math/LOG10E/browser.js | 0 .../test262/built-ins/Math/LOG10E/prop-desc.js | 18 ++++++ .../tests/test262/built-ins/Math/LOG10E/shell.js | 0 .../tests/test262/built-ins/Math/LOG10E/value.js | 16 +++++ .../tests/test262/built-ins/Math/LOG2E/browser.js | 0 .../test262/built-ins/Math/LOG2E/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/LOG2E/shell.js | 0 js/src/tests/test262/built-ins/Math/LOG2E/value.js | 16 +++++ js/src/tests/test262/built-ins/Math/PI/browser.js | 0 .../tests/test262/built-ins/Math/PI/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/PI/shell.js | 0 js/src/tests/test262/built-ins/Math/PI/value.js | 16 +++++ .../test262/built-ins/Math/SQRT1_2/browser.js | 0 .../test262/built-ins/Math/SQRT1_2/prop-desc.js | 18 ++++++ .../tests/test262/built-ins/Math/SQRT1_2/shell.js | 0 .../tests/test262/built-ins/Math/SQRT1_2/value.js | 16 +++++ .../tests/test262/built-ins/Math/SQRT2/browser.js | 0 .../test262/built-ins/Math/SQRT2/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/SQRT2/shell.js | 0 js/src/tests/test262/built-ins/Math/SQRT2/value.js | 16 +++++ .../test262/built-ins/Math/Symbol.toStringTag.js | 23 ++++++++ .../test262/built-ins/Math/abs/S15.8.2.1_A1.js | 12 ++++ .../test262/built-ins/Math/abs/S15.8.2.1_A2.js | 12 ++++ .../test262/built-ins/Math/abs/S15.8.2.1_A3.js | 14 +++++ .../test262/built-ins/Math/abs/absolute-value.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/abs/browser.js | 0 js/src/tests/test262/built-ins/Math/abs/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/abs/name.js | 28 +++++++++ .../built-ins/Math/abs/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/abs/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/abs/shell.js | 24 ++++++++ .../test262/built-ins/Math/acos/S15.8.2.2_A1.js | 12 ++++ .../test262/built-ins/Math/acos/S15.8.2.2_A2.js | 14 +++++ .../test262/built-ins/Math/acos/S15.8.2.2_A3.js | 14 +++++ .../test262/built-ins/Math/acos/S15.8.2.2_A4.js | 12 ++++ .../tests/test262/built-ins/Math/acos/browser.js | 0 js/src/tests/test262/built-ins/Math/acos/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/acos/name.js | 28 +++++++++ .../built-ins/Math/acos/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/acos/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/acos/shell.js | 24 ++++++++ .../built-ins/Math/acosh/arg-is-infinity.js | 16 +++++ .../test262/built-ins/Math/acosh/arg-is-one.js | 15 +++++ .../tests/test262/built-ins/Math/acosh/browser.js | 0 .../tests/test262/built-ins/Math/acosh/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/acosh/name.js | 28 +++++++++ .../test262/built-ins/Math/acosh/nan-returns.js | 20 +++++++ .../built-ins/Math/acosh/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/acosh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/acosh/shell.js | 24 ++++++++ .../test262/built-ins/Math/asin/S15.8.2.3_A1.js | 12 ++++ .../test262/built-ins/Math/asin/S15.8.2.3_A2.js | 14 +++++ .../test262/built-ins/Math/asin/S15.8.2.3_A3.js | 14 +++++ .../test262/built-ins/Math/asin/S15.8.2.3_A4.js | 12 ++++ .../test262/built-ins/Math/asin/S15.8.2.3_A5.js | 12 ++++ .../tests/test262/built-ins/Math/asin/browser.js | 0 js/src/tests/test262/built-ins/Math/asin/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/asin/name.js | 28 +++++++++ .../built-ins/Math/asin/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/asin/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/asin/shell.js | 24 ++++++++ .../built-ins/Math/asinh/asinh-specialVals.js | 20 +++++++ .../tests/test262/built-ins/Math/asinh/browser.js | 0 .../tests/test262/built-ins/Math/asinh/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/asinh/name.js | 28 +++++++++ .../built-ins/Math/asinh/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/asinh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/asinh/shell.js | 24 ++++++++ .../test262/built-ins/Math/atan/S15.8.2.4_A1.js | 12 ++++ .../test262/built-ins/Math/atan/S15.8.2.4_A2.js | 12 ++++ .../test262/built-ins/Math/atan/S15.8.2.4_A3.js | 12 ++++ .../tests/test262/built-ins/Math/atan/browser.js | 0 js/src/tests/test262/built-ins/Math/atan/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/atan/name.js | 28 +++++++++ .../built-ins/Math/atan/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/atan/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/atan/shell.js | 24 ++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A1.js | 39 ++++++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A14.js | 25 ++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A16.js | 29 +++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A4.js | 23 ++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A5.js | 12 ++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A8.js | 27 +++++++++ .../test262/built-ins/Math/atan2/S15.8.2.5_A9.js | 12 ++++ .../tests/test262/built-ins/Math/atan2/browser.js | 0 .../tests/test262/built-ins/Math/atan2/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/atan2/name.js | 28 +++++++++ .../built-ins/Math/atan2/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/atan2/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/atan2/shell.js | 24 ++++++++ .../built-ins/Math/atanh/atanh-specialVals.js | 33 +++++++++++ .../tests/test262/built-ins/Math/atanh/browser.js | 0 .../tests/test262/built-ins/Math/atanh/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/atanh/name.js | 28 +++++++++ .../built-ins/Math/atanh/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/atanh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/atanh/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/browser.js | 0 .../tests/test262/built-ins/Math/cbrt/browser.js | 0 .../built-ins/Math/cbrt/cbrt-specialValues.js | 20 +++++++ js/src/tests/test262/built-ins/Math/cbrt/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/cbrt/name.js | 28 +++++++++ .../built-ins/Math/cbrt/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/cbrt/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/cbrt/shell.js | 24 ++++++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A1.js | 12 ++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A2.js | 12 ++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A3.js | 12 ++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A4.js | 14 +++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A5.js | 14 +++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A6.js | 16 +++++ .../test262/built-ins/Math/ceil/S15.8.2.6_A7.js | 19 ++++++ .../tests/test262/built-ins/Math/ceil/browser.js | 0 js/src/tests/test262/built-ins/Math/ceil/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/ceil/name.js | 28 +++++++++ .../built-ins/Math/ceil/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/ceil/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/ceil/shell.js | 24 ++++++++ .../test262/built-ins/Math/clz32/Math.clz32.js | 13 ++++ .../test262/built-ins/Math/clz32/Math.clz32_1.js | 12 ++++ .../test262/built-ins/Math/clz32/Math.clz32_2.js | 12 ++++ .../tests/test262/built-ins/Math/clz32/browser.js | 0 .../tests/test262/built-ins/Math/clz32/infinity.js | 25 ++++++++ .../tests/test262/built-ins/Math/clz32/int32bit.js | 49 +++++++++++++++ .../tests/test262/built-ins/Math/clz32/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/clz32/name.js | 28 +++++++++ js/src/tests/test262/built-ins/Math/clz32/nan.js | 24 ++++++++ .../built-ins/Math/clz32/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/clz32/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/clz32/shell.js | 24 ++++++++ .../test262/built-ins/Math/cos/S15.8.2.7_A1.js | 12 ++++ .../test262/built-ins/Math/cos/S15.8.2.7_A2.js | 14 +++++ .../test262/built-ins/Math/cos/S15.8.2.7_A3.js | 14 +++++ .../test262/built-ins/Math/cos/S15.8.2.7_A4.js | 12 ++++ .../test262/built-ins/Math/cos/S15.8.2.7_A5.js | 12 ++++ js/src/tests/test262/built-ins/Math/cos/browser.js | 0 js/src/tests/test262/built-ins/Math/cos/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/cos/name.js | 28 +++++++++ .../built-ins/Math/cos/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/cos/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/cos/shell.js | 24 ++++++++ .../tests/test262/built-ins/Math/cosh/browser.js | 0 .../built-ins/Math/cosh/cosh-specialVals.js | 18 ++++++ js/src/tests/test262/built-ins/Math/cosh/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/cosh/name.js | 28 +++++++++ .../built-ins/Math/cosh/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/cosh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/cosh/shell.js | 24 ++++++++ .../test262/built-ins/Math/exp/S15.8.2.8_A1.js | 12 ++++ .../test262/built-ins/Math/exp/S15.8.2.8_A2.js | 14 +++++ .../test262/built-ins/Math/exp/S15.8.2.8_A3.js | 14 +++++ .../test262/built-ins/Math/exp/S15.8.2.8_A4.js | 14 +++++ .../test262/built-ins/Math/exp/S15.8.2.8_A5.js | 12 ++++ js/src/tests/test262/built-ins/Math/exp/browser.js | 0 js/src/tests/test262/built-ins/Math/exp/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/exp/name.js | 28 +++++++++ .../built-ins/Math/exp/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/exp/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/exp/shell.js | 24 ++++++++ .../tests/test262/built-ins/Math/expm1/browser.js | 0 .../built-ins/Math/expm1/expm1-specialVals.js | 20 +++++++ .../tests/test262/built-ins/Math/expm1/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/expm1/name.js | 28 +++++++++ .../built-ins/Math/expm1/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/expm1/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/expm1/shell.js | 24 ++++++++ .../test262/built-ins/Math/floor/S15.8.2.9_A1.js | 12 ++++ .../test262/built-ins/Math/floor/S15.8.2.9_A2.js | 12 ++++ .../test262/built-ins/Math/floor/S15.8.2.9_A3.js | 12 ++++ .../test262/built-ins/Math/floor/S15.8.2.9_A4.js | 14 +++++ .../test262/built-ins/Math/floor/S15.8.2.9_A5.js | 14 +++++ .../test262/built-ins/Math/floor/S15.8.2.9_A6.js | 16 +++++ .../test262/built-ins/Math/floor/S15.8.2.9_A7.js | 24 ++++++++ .../tests/test262/built-ins/Math/floor/browser.js | 0 .../tests/test262/built-ins/Math/floor/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/floor/name.js | 28 +++++++++ .../built-ins/Math/floor/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/floor/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/floor/shell.js | 24 ++++++++ .../built-ins/Math/fround/Math.fround_Infinity.js | 12 ++++ .../built-ins/Math/fround/Math.fround_NaN.js | 12 ++++ .../built-ins/Math/fround/Math.fround_Zero.js | 13 ++++ .../tests/test262/built-ins/Math/fround/browser.js | 0 .../tests/test262/built-ins/Math/fround/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/fround/name.js | 28 +++++++++ .../built-ins/Math/fround/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/fround/prop-desc.js | 19 ++++++ .../tests/test262/built-ins/Math/fround/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/fround/ties.js | 52 ++++++++++++++++ .../built-ins/Math/fround/value-convertion.js | 27 +++++++++ .../built-ins/Math/hypot/Math.hypot_Infinity.js | 14 +++++ .../built-ins/Math/hypot/Math.hypot_InfinityNaN.js | 14 +++++ .../test262/built-ins/Math/hypot/Math.hypot_NaN.js | 14 +++++ .../built-ins/Math/hypot/Math.hypot_NegInfinity.js | 14 +++++ .../built-ins/Math/hypot/Math.hypot_NoArgs.js | 12 ++++ .../built-ins/Math/hypot/Math.hypot_Success_2.js | 12 ++++ .../built-ins/Math/hypot/Math.hypot_ToNumberErr.js | 37 ++++++++++++ .../built-ins/Math/hypot/Math.hypot_Zero_2.js | 19 ++++++ .../tests/test262/built-ins/Math/hypot/browser.js | 0 .../tests/test262/built-ins/Math/hypot/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/hypot/name.js | 28 +++++++++ .../built-ins/Math/hypot/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/hypot/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/hypot/shell.js | 24 ++++++++ .../tests/test262/built-ins/Math/imul/browser.js | 0 js/src/tests/test262/built-ins/Math/imul/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/imul/name.js | 28 +++++++++ .../built-ins/Math/imul/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/imul/prop-desc.js | 14 +++++ .../tests/test262/built-ins/Math/imul/results.js | 60 +++++++++++++++++++ js/src/tests/test262/built-ins/Math/imul/shell.js | 24 ++++++++ .../test262/built-ins/Math/log/S15.8.2.10_A1.js | 12 ++++ .../test262/built-ins/Math/log/S15.8.2.10_A2.js | 14 +++++ .../test262/built-ins/Math/log/S15.8.2.10_A3.js | 18 ++++++ .../test262/built-ins/Math/log/S15.8.2.10_A4.js | 12 ++++ .../test262/built-ins/Math/log/S15.8.2.10_A5.js | 14 +++++ js/src/tests/test262/built-ins/Math/log/browser.js | 0 js/src/tests/test262/built-ins/Math/log/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/log/name.js | 28 +++++++++ .../built-ins/Math/log/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/log/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/log/shell.js | 24 ++++++++ .../built-ins/Math/log10/Log10-specialVals.js | 34 +++++++++++ .../tests/test262/built-ins/Math/log10/browser.js | 0 .../tests/test262/built-ins/Math/log10/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/log10/name.js | 28 +++++++++ .../built-ins/Math/log10/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/log10/prop-desc.js | 15 +++++ js/src/tests/test262/built-ins/Math/log10/shell.js | 24 ++++++++ .../tests/test262/built-ins/Math/log1p/browser.js | 0 .../tests/test262/built-ins/Math/log1p/length.js | 30 ++++++++++ js/src/tests/test262/built-ins/Math/log1p/name.js | 28 +++++++++ .../built-ins/Math/log1p/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/log1p/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/log1p/shell.js | 24 ++++++++ .../built-ins/Math/log1p/specific-results.js | 28 +++++++++ .../tests/test262/built-ins/Math/log2/browser.js | 0 js/src/tests/test262/built-ins/Math/log2/length.js | 30 ++++++++++ .../test262/built-ins/Math/log2/log2-basicTests.js | 36 +++++++++++ js/src/tests/test262/built-ins/Math/log2/name.js | 28 +++++++++ .../built-ins/Math/log2/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/log2/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/log2/shell.js | 24 ++++++++ .../test262/built-ins/Math/max/15.8.2.11-1.js | 11 ++++ .../Math/max/Math.max_each-element-coerced.js | 23 ++++++++ .../test262/built-ins/Math/max/S15.8.2.11_A1.js | 11 ++++ .../test262/built-ins/Math/max/S15.8.2.11_A2.js | 68 +++++++++++++++++++++ .../test262/built-ins/Math/max/S15.8.2.11_A4.js | 13 ++++ js/src/tests/test262/built-ins/Math/max/browser.js | 0 js/src/tests/test262/built-ins/Math/max/length.js | 28 +++++++++ js/src/tests/test262/built-ins/Math/max/name.js | 28 +++++++++ .../built-ins/Math/max/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/max/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/max/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/max/zeros.js | 22 +++++++ .../test262/built-ins/Math/min/15.8.2.12-1.js | 11 ++++ .../Math/min/Math.min_each-element-coerced.js | 23 ++++++++ .../test262/built-ins/Math/min/S15.8.2.12_A1.js | 11 ++++ .../test262/built-ins/Math/min/S15.8.2.12_A2.js | 69 ++++++++++++++++++++++ .../test262/built-ins/Math/min/S15.8.2.12_A4.js | 13 ++++ js/src/tests/test262/built-ins/Math/min/browser.js | 0 js/src/tests/test262/built-ins/Math/min/length.js | 28 +++++++++ js/src/tests/test262/built-ins/Math/min/name.js | 28 +++++++++ .../built-ins/Math/min/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/min/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/min/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/min/zeros.js | 22 +++++++ .../Math/pow/applying-the-exp-operator_A1.js | 31 ++++++++++ .../Math/pow/applying-the-exp-operator_A10.js | 26 ++++++++ .../Math/pow/applying-the-exp-operator_A11.js | 24 ++++++++ .../Math/pow/applying-the-exp-operator_A12.js | 22 +++++++ .../Math/pow/applying-the-exp-operator_A13.js | 23 ++++++++ .../Math/pow/applying-the-exp-operator_A14.js | 25 ++++++++ .../Math/pow/applying-the-exp-operator_A15.js | 21 +++++++ .../Math/pow/applying-the-exp-operator_A16.js | 23 ++++++++ .../Math/pow/applying-the-exp-operator_A17.js | 22 +++++++ .../Math/pow/applying-the-exp-operator_A18.js | 24 ++++++++ .../Math/pow/applying-the-exp-operator_A19.js | 21 +++++++ .../Math/pow/applying-the-exp-operator_A2.js | 29 +++++++++ .../Math/pow/applying-the-exp-operator_A20.js | 23 ++++++++ .../Math/pow/applying-the-exp-operator_A21.js | 23 ++++++++ .../Math/pow/applying-the-exp-operator_A22.js | 25 ++++++++ .../Math/pow/applying-the-exp-operator_A23.js | 39 ++++++++++++ .../Math/pow/applying-the-exp-operator_A3.js | 29 +++++++++ .../Math/pow/applying-the-exp-operator_A4.js | 29 +++++++++ .../Math/pow/applying-the-exp-operator_A5.js | 26 ++++++++ .../Math/pow/applying-the-exp-operator_A6.js | 24 ++++++++ .../Math/pow/applying-the-exp-operator_A7.js | 24 ++++++++ .../Math/pow/applying-the-exp-operator_A8.js | 24 ++++++++ .../Math/pow/applying-the-exp-operator_A9.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/pow/browser.js | 0 .../built-ins/Math/pow/int32_min-exponent.js | 19 ++++++ js/src/tests/test262/built-ins/Math/pow/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/pow/name.js | 28 +++++++++ .../built-ins/Math/pow/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/pow/prop-desc.js | 18 ++++++ js/src/tests/test262/built-ins/Math/pow/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/prop-desc.js | 42 +++++++++++++ js/src/tests/test262/built-ins/Math/proto.js | 19 ++++++ .../test262/built-ins/Math/random/S15.8.2.14_A1.js | 30 ++++++++++ .../tests/test262/built-ins/Math/random/browser.js | 0 .../tests/test262/built-ins/Math/random/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/random/name.js | 28 +++++++++ .../built-ins/Math/random/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/random/prop-desc.js | 19 ++++++ .../tests/test262/built-ins/Math/random/shell.js | 24 ++++++++ .../test262/built-ins/Math/round/S15.8.2.15_A1.js | 12 ++++ .../test262/built-ins/Math/round/S15.8.2.15_A2.js | 12 ++++ .../test262/built-ins/Math/round/S15.8.2.15_A3.js | 12 ++++ .../test262/built-ins/Math/round/S15.8.2.15_A4.js | 14 +++++ .../test262/built-ins/Math/round/S15.8.2.15_A5.js | 14 +++++ .../test262/built-ins/Math/round/S15.8.2.15_A6.js | 44 ++++++++++++++ .../test262/built-ins/Math/round/S15.8.2.15_A7.js | 60 +++++++++++++++++++ .../tests/test262/built-ins/Math/round/browser.js | 0 .../tests/test262/built-ins/Math/round/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/round/name.js | 28 +++++++++ .../built-ins/Math/round/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/round/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/round/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/shell.js | 0 .../tests/test262/built-ins/Math/sign/browser.js | 0 js/src/tests/test262/built-ins/Math/sign/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/sign/name.js | 28 +++++++++ .../built-ins/Math/sign/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/sign/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/sign/shell.js | 24 ++++++++ .../built-ins/Math/sign/sign-specialVals.js | 22 +++++++ .../test262/built-ins/Math/sin/S15.8.2.16_A1.js | 12 ++++ .../test262/built-ins/Math/sin/S15.8.2.16_A4.js | 12 ++++ .../test262/built-ins/Math/sin/S15.8.2.16_A5.js | 12 ++++ js/src/tests/test262/built-ins/Math/sin/browser.js | 0 js/src/tests/test262/built-ins/Math/sin/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/sin/name.js | 28 +++++++++ .../built-ins/Math/sin/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/sin/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/sin/shell.js | 24 ++++++++ js/src/tests/test262/built-ins/Math/sin/zero.js | 12 ++++ .../tests/test262/built-ins/Math/sinh/browser.js | 0 js/src/tests/test262/built-ins/Math/sinh/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/sinh/name.js | 28 +++++++++ .../built-ins/Math/sinh/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/sinh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/sinh/shell.js | 24 ++++++++ .../built-ins/Math/sinh/sinh-specialVals.js | 20 +++++++ .../test262/built-ins/Math/sqrt/S15.8.2.17_A1.js | 12 ++++ .../test262/built-ins/Math/sqrt/S15.8.2.17_A2.js | 14 +++++ .../test262/built-ins/Math/sqrt/S15.8.2.17_A3.js | 12 ++++ .../test262/built-ins/Math/sqrt/S15.8.2.17_A4.js | 12 ++++ .../test262/built-ins/Math/sqrt/S15.8.2.17_A5.js | 14 +++++ .../tests/test262/built-ins/Math/sqrt/browser.js | 0 js/src/tests/test262/built-ins/Math/sqrt/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/sqrt/name.js | 28 +++++++++ .../built-ins/Math/sqrt/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/sqrt/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/sqrt/shell.js | 24 ++++++++ .../test262/built-ins/Math/tan/S15.8.2.18_A1.js | 12 ++++ .../test262/built-ins/Math/tan/S15.8.2.18_A2.js | 12 ++++ .../test262/built-ins/Math/tan/S15.8.2.18_A3.js | 12 ++++ .../test262/built-ins/Math/tan/S15.8.2.18_A4.js | 12 ++++ .../test262/built-ins/Math/tan/S15.8.2.18_A5.js | 12 ++++ js/src/tests/test262/built-ins/Math/tan/browser.js | 0 js/src/tests/test262/built-ins/Math/tan/length.js | 31 ++++++++++ js/src/tests/test262/built-ins/Math/tan/name.js | 28 +++++++++ .../built-ins/Math/tan/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/tan/prop-desc.js | 19 ++++++ js/src/tests/test262/built-ins/Math/tan/shell.js | 24 ++++++++ .../tests/test262/built-ins/Math/tanh/browser.js | 0 js/src/tests/test262/built-ins/Math/tanh/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/tanh/name.js | 28 +++++++++ .../built-ins/Math/tanh/not-a-constructor.js | 31 ++++++++++ .../tests/test262/built-ins/Math/tanh/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/tanh/shell.js | 24 ++++++++ .../built-ins/Math/tanh/tanh-specialVals.js | 20 +++++++ .../built-ins/Math/trunc/Math.trunc_Infinity.js | 13 ++++ .../test262/built-ins/Math/trunc/Math.trunc_NaN.js | 12 ++++ .../built-ins/Math/trunc/Math.trunc_NegDecimal.js | 12 ++++ .../built-ins/Math/trunc/Math.trunc_PosDecimal.js | 12 ++++ .../built-ins/Math/trunc/Math.trunc_Success.js | 12 ++++ .../built-ins/Math/trunc/Math.trunc_Zero.js | 12 ++++ .../tests/test262/built-ins/Math/trunc/browser.js | 0 .../tests/test262/built-ins/Math/trunc/length.js | 27 +++++++++ js/src/tests/test262/built-ins/Math/trunc/name.js | 28 +++++++++ .../built-ins/Math/trunc/not-a-constructor.js | 31 ++++++++++ .../test262/built-ins/Math/trunc/prop-desc.js | 14 +++++ js/src/tests/test262/built-ins/Math/trunc/shell.js | 24 ++++++++ .../built-ins/Math/trunc/trunc-sampleTests.js | 49 +++++++++++++++ .../built-ins/Math/trunc/trunc-specialVals.js | 18 ++++++ 399 files changed, 7853 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Math/E/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/E/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/E/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/E/value.js create mode 100644 js/src/tests/test262/built-ins/Math/LN10/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/LN10/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/LN10/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/LN10/value.js create mode 100644 js/src/tests/test262/built-ins/Math/LN2/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/LN2/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/LN2/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/LN2/value.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG10E/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG10E/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG10E/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG10E/value.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG2E/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG2E/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG2E/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/LOG2E/value.js create mode 100644 js/src/tests/test262/built-ins/Math/PI/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/PI/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/PI/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/PI/value.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT1_2/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT1_2/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT1_2/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT1_2/value.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT2/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT2/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT2/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/SQRT2/value.js create mode 100644 js/src/tests/test262/built-ins/Math/Symbol.toStringTag.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/absolute-value.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/length.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/name.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/abs/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/length.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/name.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/acos/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/arg-is-infinity.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/arg-is-one.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/nan-returns.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/acosh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/length.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/name.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/asin/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/asinh-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/asinh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/length.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/name.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/atan/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/length.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/name.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/atan2/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/atanh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/length.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/name.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/cbrt/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A6.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A7.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/length.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/name.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/ceil/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/Math.clz32.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/Math.clz32_1.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/Math.clz32_2.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/infinity.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/int32bit.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/length.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/name.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/nan.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/clz32/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/length.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/name.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/cos/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/cosh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/length.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/name.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/exp/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/length.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/name.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/expm1/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A6.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A7.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/length.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/name.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/floor/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/Math.fround_Infinity.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/Math.fround_NaN.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/Math.fround_Zero.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/length.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/name.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/ties.js create mode 100644 js/src/tests/test262/built-ins/Math/fround/value-convertion.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_ToNumberErr.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/length.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/name.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/hypot/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/length.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/name.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/results.js create mode 100644 js/src/tests/test262/built-ins/Math/imul/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/log/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/log/length.js create mode 100644 js/src/tests/test262/built-ins/Math/log/name.js create mode 100644 js/src/tests/test262/built-ins/Math/log/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/log/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/log/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/Log10-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/length.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/name.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/log10/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/length.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/name.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/log1p/specific-results.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/length.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/log2-basicTests.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/name.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/log2/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/max/15.8.2.11-1.js create mode 100644 js/src/tests/test262/built-ins/Math/max/Math.max_each-element-coerced.js create mode 100644 js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/max/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/max/length.js create mode 100644 js/src/tests/test262/built-ins/Math/max/name.js create mode 100644 js/src/tests/test262/built-ins/Math/max/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/max/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/max/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/max/zeros.js create mode 100644 js/src/tests/test262/built-ins/Math/min/15.8.2.12-1.js create mode 100644 js/src/tests/test262/built-ins/Math/min/Math.min_each-element-coerced.js create mode 100644 js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/min/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/min/length.js create mode 100644 js/src/tests/test262/built-ins/Math/min/name.js create mode 100644 js/src/tests/test262/built-ins/Math/min/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/min/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/min/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/min/zeros.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/length.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/name.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/pow/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/proto.js create mode 100644 js/src/tests/test262/built-ins/Math/random/S15.8.2.14_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/random/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/random/length.js create mode 100644 js/src/tests/test262/built-ins/Math/random/name.js create mode 100644 js/src/tests/test262/built-ins/Math/random/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/random/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/random/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A6.js create mode 100644 js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A7.js create mode 100644 js/src/tests/test262/built-ins/Math/round/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/round/length.js create mode 100644 js/src/tests/test262/built-ins/Math/round/name.js create mode 100644 js/src/tests/test262/built-ins/Math/round/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/round/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/round/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/length.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/name.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/length.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/name.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/sin/zero.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/sinh/sinh-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/length.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/name.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/sqrt/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A1.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A2.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A3.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A4.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A5.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/length.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/name.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/tan/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/length.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/name.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Infinity.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NaN.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NegDecimal.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_PosDecimal.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Success.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Zero.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/browser.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/length.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/name.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/shell.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/trunc-sampleTests.js create mode 100644 js/src/tests/test262/built-ins/Math/trunc/trunc-specialVals.js (limited to 'js/src/tests/test262/built-ins/Math') diff --git a/js/src/tests/test262/built-ins/Math/E/browser.js b/js/src/tests/test262/built-ins/Math/E/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/E/prop-desc.js b/js/src/tests/test262/built-ins/Math/E/prop-desc.js new file mode 100644 index 0000000000..79db7e0b94 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/E/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.e +description: > + "E" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'E'); +verifyNotWritable(Math, 'E'); +verifyNotConfigurable(Math, 'E'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/E/shell.js b/js/src/tests/test262/built-ins/Math/E/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/E/value.js b/js/src/tests/test262/built-ins/Math/E/value.js new file mode 100644 index 0000000000..431d3655f4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/E/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LN10/browser.js b/js/src/tests/test262/built-ins/Math/LN10/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LN10/prop-desc.js b/js/src/tests/test262/built-ins/Math/LN10/prop-desc.js new file mode 100644 index 0000000000..87f49f1a50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LN10/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.ln10 +description: > + "LN10" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'LN10'); +verifyNotWritable(Math, 'LN10'); +verifyNotConfigurable(Math, 'LN10'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LN10/shell.js b/js/src/tests/test262/built-ins/Math/LN10/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LN10/value.js b/js/src/tests/test262/built-ins/Math/LN10/value.js new file mode 100644 index 0000000000..dd51aa838c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LN10/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LN2/browser.js b/js/src/tests/test262/built-ins/Math/LN2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LN2/prop-desc.js b/js/src/tests/test262/built-ins/Math/LN2/prop-desc.js new file mode 100644 index 0000000000..8c7b2222fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LN2/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.ln2 +description: > + "LN2" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'LN2'); +verifyNotWritable(Math, 'LN2'); +verifyNotConfigurable(Math, 'LN2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LN2/shell.js b/js/src/tests/test262/built-ins/Math/LN2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LN2/value.js b/js/src/tests/test262/built-ins/Math/LN2/value.js new file mode 100644 index 0000000000..d67e2c2981 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LN2/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LOG10E/browser.js b/js/src/tests/test262/built-ins/Math/LOG10E/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LOG10E/prop-desc.js b/js/src/tests/test262/built-ins/Math/LOG10E/prop-desc.js new file mode 100644 index 0000000000..5ca90b6af1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LOG10E/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.log10e +description: > + "LOG10E" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'LOG10E'); +verifyNotWritable(Math, 'LOG10E'); +verifyNotConfigurable(Math, 'LOG10E'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LOG10E/shell.js b/js/src/tests/test262/built-ins/Math/LOG10E/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LOG10E/value.js b/js/src/tests/test262/built-ins/Math/LOG10E/value.js new file mode 100644 index 0000000000..3677aea0f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LOG10E/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LOG2E/browser.js b/js/src/tests/test262/built-ins/Math/LOG2E/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LOG2E/prop-desc.js b/js/src/tests/test262/built-ins/Math/LOG2E/prop-desc.js new file mode 100644 index 0000000000..30847f9aab --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LOG2E/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.log2e +description: > + "LOG2E" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'LOG2E'); +verifyNotWritable(Math, 'LOG2E'); +verifyNotConfigurable(Math, 'LOG2E'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/LOG2E/shell.js b/js/src/tests/test262/built-ins/Math/LOG2E/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/LOG2E/value.js b/js/src/tests/test262/built-ins/Math/LOG2E/value.js new file mode 100644 index 0000000000..06bafa1d9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/LOG2E/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/PI/browser.js b/js/src/tests/test262/built-ins/Math/PI/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/PI/prop-desc.js b/js/src/tests/test262/built-ins/Math/PI/prop-desc.js new file mode 100644 index 0000000000..c3ee153ec1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/PI/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.pi +description: > + "PI" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'PI'); +verifyNotWritable(Math, 'PI'); +verifyNotConfigurable(Math, 'PI'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/PI/shell.js b/js/src/tests/test262/built-ins/Math/PI/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/PI/value.js b/js/src/tests/test262/built-ins/Math/PI/value.js new file mode 100644 index 0000000000..b384583b08 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/PI/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/SQRT1_2/browser.js b/js/src/tests/test262/built-ins/Math/SQRT1_2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/SQRT1_2/prop-desc.js b/js/src/tests/test262/built-ins/Math/SQRT1_2/prop-desc.js new file mode 100644 index 0000000000..a7617144cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/SQRT1_2/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.sqrt1_2 +description: > + "SQRT1_2" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'SQRT1_2'); +verifyNotWritable(Math, 'SQRT1_2'); +verifyNotConfigurable(Math, 'SQRT1_2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/SQRT1_2/shell.js b/js/src/tests/test262/built-ins/Math/SQRT1_2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/SQRT1_2/value.js b/js/src/tests/test262/built-ins/Math/SQRT1_2/value.js new file mode 100644 index 0000000000..b5b0176431 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/SQRT1_2/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/SQRT2/browser.js b/js/src/tests/test262/built-ins/Math/SQRT2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/SQRT2/prop-desc.js b/js/src/tests/test262/built-ins/Math/SQRT2/prop-desc.js new file mode 100644 index 0000000000..d56e397fcb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/SQRT2/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.sqrt2 +description: > + "SQRT2" property of Math +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Math, 'SQRT2'); +verifyNotWritable(Math, 'SQRT2'); +verifyNotConfigurable(Math, 'SQRT2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/SQRT2/shell.js b/js/src/tests/test262/built-ins/Math/SQRT2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/SQRT2/value.js b/js/src/tests/test262/built-ins/Math/SQRT2/value.js new file mode 100644 index 0000000000..cf06696db0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/SQRT2/value.js @@ -0,0 +1,16 @@ +// 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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/Math/Symbol.toStringTag.js new file mode 100644 index 0000000000..3a419fa2c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/Symbol.toStringTag.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 20.2.1.9 +description: > + `Symbol.toStringTag` property descriptor +info: | + The initial value of the @@toStringTag property is the String value + "Math". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Math[Symbol.toStringTag], 'Math'); + +verifyNotEnumerable(Math, Symbol.toStringTag); +verifyNotWritable(Math, Symbol.toStringTag); +verifyConfigurable(Math, Symbol.toStringTag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A1.js b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A1.js new file mode 100644 index 0000000000..4bfb1f5a4f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.abs(x) is NaN +es5id: 15.8.2.1_A1 +description: Checking if Math.abs(NaN) is NaN +---*/ + +assert.sameValue(Math.abs(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A2.js b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A2.js new file mode 100644 index 0000000000..1ee03e5ec4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.abs(x) is +0 +es5id: 15.8.2.1_A2 +description: Checking if Math.abs(-0) equals to +0 +---*/ + +assert.sameValue(Math.abs(-0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A3.js b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A3.js new file mode 100644 index 0000000000..d2207aa004 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/S15.8.2.1_A3.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. + +/*--- +info: If x is -Infinity, Math.abs(x) is +Infinity +es5id: 15.8.2.1_A3 +description: Checking if Math.abs(-Infinity) equals to +Infinity +---*/ + +// CHECK#1 +var x = -Infinity; +assert.sameValue(Math.abs(x), +Infinity, 'Math.abs(-Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/absolute-value.js b/js/src/tests/test262/built-ins/Math/abs/absolute-value.js new file mode 100644 index 0000000000..9aa95e5a29 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/absolute-value.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.abs +description: > + Returns the absolute value of x +info: | + Math.abs ( x ) + + Returns the absolute value of x; the result has the same magnitude as x but + has positive sign. +---*/ + +assert.sameValue(Math.abs(-42), 42, "-42"); +assert.sameValue(Math.abs(42), 42, "42"); +assert.sameValue(Math.abs(-0.000001), 0.000001, "-0.000001"); +assert.sameValue(Math.abs(0.000001), 0.000001, "0.000001"); +assert.sameValue(Math.abs(-1e-17), 1e-17, "-1e-17"); +assert.sameValue(Math.abs(1e-17), 1e-17, "1e-17"); +assert.sameValue(Math.abs(-9007199254740991), 9007199254740991, "-(2**53-1)"); +assert.sameValue(Math.abs(9007199254740991), 9007199254740991, "2**53-1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/browser.js b/js/src/tests/test262/built-ins/Math/abs/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/abs/length.js b/js/src/tests/test262/built-ins/Math/abs/length.js new file mode 100644 index 0000000000..2d031962ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.1 +description: > + Math.abs.length is 1. +info: | + Math.abs ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.abs.length, 1); + +verifyNotEnumerable(Math.abs, "length"); +verifyNotWritable(Math.abs, "length"); +verifyConfigurable(Math.abs, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/name.js b/js/src/tests/test262/built-ins/Math/abs/name.js new file mode 100644 index 0000000000..640f07b811 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.1 +description: > + Math.abs.name is "abs". +info: | + Math.abs ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.abs.name, "abs"); + +verifyNotEnumerable(Math.abs, "name"); +verifyNotWritable(Math.abs, "name"); +verifyConfigurable(Math.abs, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/abs/not-a-constructor.js new file mode 100644 index 0000000000..3fc474119f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.abs does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.abs), false, 'isConstructor(Math.abs) must return false'); + +assert.throws(TypeError, () => { + new Math.abs(); +}, '`new Math.abs()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/prop-desc.js b/js/src/tests/test262/built-ins/Math/abs/prop-desc.js new file mode 100644 index 0000000000..11d01c2d6f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.abs +description: > + "abs" property of Math +info: | + Section 17: 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(Math, "abs"); +verifyWritable(Math, "abs"); +verifyConfigurable(Math, "abs"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/abs/shell.js b/js/src/tests/test262/built-ins/Math/abs/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/abs/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A1.js b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A1.js new file mode 100644 index 0000000000..1805c4bdae --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.acos(x) is NaN +es5id: 15.8.2.2_A1 +description: Checking if Math.acos(NaN) is NaN +---*/ + +assert.sameValue(Math.acos(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A2.js b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A2.js new file mode 100644 index 0000000000..fe1c9883b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A2.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. + +/*--- +info: If x is greater than 1, Math.acos(x) is NaN +es5id: 15.8.2.2_A2 +description: Checking if Math.acos(x) is NaN, where x is greater than 1 +---*/ + +assert.sameValue(Math.acos(1.000000000000001), NaN, "1.000000000000001"); +assert.sameValue(Math.acos(2), NaN, "2"); +assert.sameValue(Math.acos(Infinity), NaN, "Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A3.js b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A3.js new file mode 100644 index 0000000000..ec097dab8a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A3.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. + +/*--- +info: If x is less than -1, Math.acos(x) is NaN +es5id: 15.8.2.2_A3 +description: Checking if Math.acos(x) is NaN, where x is less than -1 +---*/ + +assert.sameValue(Math.acos(-1.000000000000001), NaN, "-1.000000000000001"); +assert.sameValue(Math.acos(-2), NaN, "-2"); +assert.sameValue(Math.acos(-Infinity), NaN, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A4.js b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A4.js new file mode 100644 index 0000000000..03f095e8e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/S15.8.2.2_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is exactly 1, Math.acos(x) is +0 +es5id: 15.8.2.2_A4 +description: Checking if Math.acos(1) equals to +0 +---*/ + +assert.sameValue(Math.acos(1), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/browser.js b/js/src/tests/test262/built-ins/Math/acos/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/acos/length.js b/js/src/tests/test262/built-ins/Math/acos/length.js new file mode 100644 index 0000000000..0d1fca6e4a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.2 +description: > + Math.acos.length is 1. +info: | + Math.acos ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.acos.length, 1); + +verifyNotEnumerable(Math.acos, "length"); +verifyNotWritable(Math.acos, "length"); +verifyConfigurable(Math.acos, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/name.js b/js/src/tests/test262/built-ins/Math/acos/name.js new file mode 100644 index 0000000000..d441d92d10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.2 +description: > + Math.acos.name is "acos". +info: | + Math.acos ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.acos.name, "acos"); + +verifyNotEnumerable(Math.acos, "name"); +verifyNotWritable(Math.acos, "name"); +verifyConfigurable(Math.acos, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/acos/not-a-constructor.js new file mode 100644 index 0000000000..659f497ee4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.acos does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.acos), false, 'isConstructor(Math.acos) must return false'); + +assert.throws(TypeError, () => { + new Math.acos(); +}, '`new Math.acos()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/prop-desc.js b/js/src/tests/test262/built-ins/Math/acos/prop-desc.js new file mode 100644 index 0000000000..a0f2e2af6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.acos +description: > + "acos" property of Math +info: | + Section 17: 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(Math, "acos"); +verifyWritable(Math, "acos"); +verifyConfigurable(Math, "acos"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acos/shell.js b/js/src/tests/test262/built-ins/Math/acos/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acos/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/acosh/arg-is-infinity.js b/js/src/tests/test262/built-ins/Math/acosh/arg-is-infinity.js new file mode 100644 index 0000000000..087498f3f1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/arg-is-infinity.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.acosh +description: > + Return Infinity if x is Infinity +info: | + Math.acosh ( x ) + + If x is +∞, the result is +∞. +---*/ + +assert.sameValue(Math.acosh(Infinity), Infinity); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/arg-is-one.js b/js/src/tests/test262/built-ins/Math/acosh/arg-is-one.js new file mode 100644 index 0000000000..5d03d7d930 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/arg-is-one.js @@ -0,0 +1,15 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.acosh(1) returns +0 +es6id: 20.2.2.3 +info: | + Math.acosh ( x ) + + - If x is 1, the result is +0. +---*/ + +assert.sameValue(Math.acosh(+1), 0, "Math.acosh should produce 0 for +1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/browser.js b/js/src/tests/test262/built-ins/Math/acosh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/acosh/length.js b/js/src/tests/test262/built-ins/Math/acosh/length.js new file mode 100644 index 0000000000..10b7e3c234 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.3 +description: length property of Math.acosh +info: | + Math.acosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.acosh.length, 1); + +verifyNotEnumerable(Math.acosh, "length"); +verifyNotWritable(Math.acosh, "length"); +verifyConfigurable(Math.acosh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/name.js b/js/src/tests/test262/built-ins/Math/acosh/name.js new file mode 100644 index 0000000000..5ff5df412f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.3 +description: > + Math.acosh.name is "acosh". +info: | + Math.acosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.acosh.name, "acosh"); + +verifyNotEnumerable(Math.acosh, "name"); +verifyNotWritable(Math.acosh, "name"); +verifyConfigurable(Math.acosh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/nan-returns.js b/js/src/tests/test262/built-ins/Math/acosh/nan-returns.js new file mode 100644 index 0000000000..17a96a2adb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/nan-returns.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.acosh with special values +es6id: 20.2.2.3 +info: | + Math.acosh ( x ) + + - If x is NaN, the result is NaN. + - If x is less than 1, the result is NaN. +---*/ + +assert.sameValue(Math.acosh(NaN), NaN, "NaN"); +assert.sameValue(Math.acosh(0.999999), NaN, "0.999999"); +assert.sameValue(Math.acosh(0), NaN, "0"); +assert.sameValue(Math.acosh(-1), NaN, "-1"); +assert.sameValue(Math.acosh(-Infinity), NaN, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/acosh/not-a-constructor.js new file mode 100644 index 0000000000..b9866a9eb4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.acosh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.acosh), false, 'isConstructor(Math.acosh) must return false'); + +assert.throws(TypeError, () => { + new Math.acosh(); +}, '`new Math.acosh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/prop-desc.js b/js/src/tests/test262/built-ins/Math/acosh/prop-desc.js new file mode 100644 index 0000000000..2e574afcc2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.acosh +includes: [propertyHelper.js] +es6id: 20.2.2.3 +---*/ + +verifyNotEnumerable(Math, "acosh"); +verifyWritable(Math, "acosh"); +verifyConfigurable(Math, "acosh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/acosh/shell.js b/js/src/tests/test262/built-ins/Math/acosh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/acosh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A1.js b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A1.js new file mode 100644 index 0000000000..383b5faa1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.asin(x) is NaN +es5id: 15.8.2.3_A1 +description: Checking if Math.asin(NaN) is NaN +---*/ + +assert.sameValue(Math.asin(NaN), NaN, "NaN"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A2.js b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A2.js new file mode 100644 index 0000000000..1e8e4799c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A2.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. + +/*--- +info: If x is greater than 1, Math.asin(x) is NaN +es5id: 15.8.2.3_A2 +description: Checking if Math.asin(x) is NaN, where x is greater than 1 +---*/ + +assert.sameValue(Math.asin(1.000000000000001), NaN, "1.000000000000001"); +assert.sameValue(Math.asin(2), NaN, "2"); +assert.sameValue(Math.asin(Infinity), NaN, "Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A3.js b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A3.js new file mode 100644 index 0000000000..b6e456b99c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A3.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. + +/*--- +info: If x is less than -1, Math.asin(x) is NaN +es5id: 15.8.2.3_A3 +description: Checking if Math.asin(x) is NaN, where x is less than -1 +---*/ + +assert.sameValue(Math.asin(-1.000000000000001), NaN, "-1.000000000000001"); +assert.sameValue(Math.asin(-2), NaN, "-2"); +assert.sameValue(Math.asin(-Infinity), NaN, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A4.js b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A4.js new file mode 100644 index 0000000000..bf2373406b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.asin(x) is +0 +es5id: 15.8.2.3_A4 +description: Checking if Math.asin(+0) equals +0 +---*/ + +assert.sameValue(Math.asin(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A5.js b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A5.js new file mode 100644 index 0000000000..7d95cb1072 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/S15.8.2.3_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.asin(x) is -0 +es5id: 15.8.2.3_A5 +description: Checking if Math.asin(-0) equals to -0 +---*/ + +assert.sameValue(Math.asin(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/browser.js b/js/src/tests/test262/built-ins/Math/asin/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/asin/length.js b/js/src/tests/test262/built-ins/Math/asin/length.js new file mode 100644 index 0000000000..40ddb05dea --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.4 +description: > + Math.asin.length is 1. +info: | + Math.asin ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.asin.length, 1); + +verifyNotEnumerable(Math.asin, "length"); +verifyNotWritable(Math.asin, "length"); +verifyConfigurable(Math.asin, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/name.js b/js/src/tests/test262/built-ins/Math/asin/name.js new file mode 100644 index 0000000000..2d63be0e06 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.4 +description: > + Math.asin.name is "asin". +info: | + Math.asin ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.asin.name, "asin"); + +verifyNotEnumerable(Math.asin, "name"); +verifyNotWritable(Math.asin, "name"); +verifyConfigurable(Math.asin, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/asin/not-a-constructor.js new file mode 100644 index 0000000000..adcadf0892 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.asin does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.asin), false, 'isConstructor(Math.asin) must return false'); + +assert.throws(TypeError, () => { + new Math.asin(); +}, '`new Math.asin()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/prop-desc.js b/js/src/tests/test262/built-ins/Math/asin/prop-desc.js new file mode 100644 index 0000000000..e9838e9db6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.acos +description: > + "asin" property of Math +info: | + Section 17: 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(Math, "asin"); +verifyWritable(Math, "asin"); +verifyConfigurable(Math, "asin"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asin/shell.js b/js/src/tests/test262/built-ins/Math/asin/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asin/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/asinh/asinh-specialVals.js b/js/src/tests/test262/built-ins/Math/asinh/asinh-specialVals.js new file mode 100644 index 0000000000..d6d7e711ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/asinh-specialVals.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.asinh with special values +es6id: 20.2.2.5 +---*/ + +assert.sameValue(Math.asinh(NaN), Number.NaN, + "Math.asinh produces incorrect output for NaN"); +assert.sameValue(Math.asinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, + "Math.asinh should produce negative infinity for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.asinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.asinh should produce positive infinity for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.asinh(-0), Number.NEGATIVE_INFINITY, + "Math.asinh should produce -0 for -0"); +assert.sameValue(1 / Math.asinh(0), Number.POSITIVE_INFINITY, + "Math.asinh should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asinh/browser.js b/js/src/tests/test262/built-ins/Math/asinh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/asinh/length.js b/js/src/tests/test262/built-ins/Math/asinh/length.js new file mode 100644 index 0000000000..7dcd44f621 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.asinh +es6id: 20.2.2.5 +info: | + Math.asinh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.asinh.length, 1); + +verifyNotEnumerable(Math.asinh, "length"); +verifyNotWritable(Math.asinh, "length"); +verifyConfigurable(Math.asinh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asinh/name.js b/js/src/tests/test262/built-ins/Math/asinh/name.js new file mode 100644 index 0000000000..252117b048 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.5 +description: > + Math.asinh.name is "asinh". +info: | + Math.asinh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.asinh.name, "asinh"); + +verifyNotEnumerable(Math.asinh, "name"); +verifyNotWritable(Math.asinh, "name"); +verifyConfigurable(Math.asinh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asinh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/asinh/not-a-constructor.js new file mode 100644 index 0000000000..bfb53cc7ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.asinh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.asinh), false, 'isConstructor(Math.asinh) must return false'); + +assert.throws(TypeError, () => { + new Math.asinh(); +}, '`new Math.asinh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asinh/prop-desc.js b/js/src/tests/test262/built-ins/Math/asinh/prop-desc.js new file mode 100644 index 0000000000..7c65e4d1df --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.asinh +includes: [propertyHelper.js] +es6id: 20.2.2.5 +---*/ + +verifyNotEnumerable(Math, "asinh"); +verifyWritable(Math, "asinh"); +verifyConfigurable(Math, "asinh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/asinh/shell.js b/js/src/tests/test262/built-ins/Math/asinh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/asinh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A1.js b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A1.js new file mode 100644 index 0000000000..ab45a2375b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.atan(x) is NaN +es5id: 15.8.2.4_A1 +description: Checking if Math.atan(NaN) is NaN +---*/ + +assert.sameValue(Math.atan(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A2.js b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A2.js new file mode 100644 index 0000000000..16a365fecd --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.atan(x) is +0 +es5id: 15.8.2.4_A2 +description: Checking if Math.atan(+0) equals to +0 +---*/ + +assert.sameValue(Math.atan(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A3.js b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A3.js new file mode 100644 index 0000000000..9b0bff09ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/S15.8.2.4_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.atan(x) is -0 +es5id: 15.8.2.4_A3 +description: Checking if Math.atan(-0) equals to -0 +---*/ + +assert.sameValue(Math.atan(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/browser.js b/js/src/tests/test262/built-ins/Math/atan/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/atan/length.js b/js/src/tests/test262/built-ins/Math/atan/length.js new file mode 100644 index 0000000000..e2a3cfc5ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.6 +description: > + Math.atan.length is 1. +info: | + Math.atan ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atan.length, 1); + +verifyNotEnumerable(Math.atan, "length"); +verifyNotWritable(Math.atan, "length"); +verifyConfigurable(Math.atan, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/name.js b/js/src/tests/test262/built-ins/Math/atan/name.js new file mode 100644 index 0000000000..56009ad6fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.6 +description: > + Math.atan.name is "atan". +info: | + Math.atan ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atan.name, "atan"); + +verifyNotEnumerable(Math.atan, "name"); +verifyNotWritable(Math.atan, "name"); +verifyConfigurable(Math.atan, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/atan/not-a-constructor.js new file mode 100644 index 0000000000..0b00568ba9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.atan does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.atan), false, 'isConstructor(Math.atan) must return false'); + +assert.throws(TypeError, () => { + new Math.atan(); +}, '`new Math.atan()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/prop-desc.js b/js/src/tests/test262/built-ins/Math/atan/prop-desc.js new file mode 100644 index 0000000000..a5f3eb327c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.atan +description: > + "atan" property of Math +info: | + Section 17: 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(Math, "atan"); +verifyWritable(Math, "atan"); +verifyConfigurable(Math, "atan"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan/shell.js b/js/src/tests/test262/built-ins/Math/atan/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js new file mode 100644 index 0000000000..af55dbb0de --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If either x or y is NaN, Math(x,y) is NaN +es5id: 15.8.2.5_A1 +description: > + Checking if Math.atan2(NaN,y) and Math.atan2(x,NaN) is NaN for + different x and y values +---*/ + +// CHECK#1 + +var vals = new Array(); +vals[0] = -Infinity; +vals[1] = -0.000000000000001; +vals[2] = -0; +vals[3] = +0 +vals[4] = 0.000000000000001; +vals[5] = +Infinity; +vals[6] = NaN; +var valnum = 7; + +var args = new Array(); +for (var i = 0; i < 2; i++) +{ + args[i] = NaN; + for (var j = 0; j < valnum; j++) + { + args[1 - i] = vals[j]; + assert.sameValue( + Math.atan2(args[0], args[1]), + NaN, + "(" + args[0] + ", " + args[1] + ")" + ); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js new file mode 100644 index 0000000000..34ad7202c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A14.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y>0 and y is finite and x is equal to +Infinity, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A14 +description: > + Checking if Math.atan2(y,x) equals to +0, where y>0 and y is + finite and x is equal to +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +var y = new Array(); +y[0] = 0.000000000000001; +y[1] = 1; +y[2] = 1.7976931348623157E308; //largest finite number +var ynum = 3; + +for (var i = 0; i < ynum; i++) +{ + assert.sameValue(Math.atan2(y[i], x), 0, y[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js new file mode 100644 index 0000000000..ab59d87d44 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A16.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y<0 and y is finite and x is equal to +Infinity, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A16 +description: > + Checking if Math.atan2(y,x) is -0, where y<0 and y is finite and x + is equal to +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +var y = new Array(); +y[0] = -0.000000000000001; +y[1] = -1; +y[2] = -1.7976931348623157E308; //largest by abs() finite number +var ynum = 3; + +for (var i = 0; i < ynum; i++) +{ + assert.sameValue( + Math.atan2(y[i], x), + -0, + "(" + y[i] + ", Infinity)" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.js new file mode 100644 index 0000000000..cb1c29c127 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A4.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. + +/*--- +info: If y is +0 and x>0, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A4 +description: Checking if Math.atan2(y,x) equals to +0, where y is +0 and x>0 +---*/ + +// CHECK#1 +var y = +0; +var x = new Array(); +x[0] = 0.000000000000001; +x[2] = +Infinity; +x[1] = 1; +var xnum = 3; + +for (var i = 0; i < xnum; i++) +{ + assert.sameValue(Math.atan2(y, x[i]), 0, x[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js new file mode 100644 index 0000000000..50ef5c0a87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +0 and x is +0, Math.atan2(y,x) is +0 +es5id: 15.8.2.5_A5 +description: Checking if Math.atan2(y,x) is +0, where y is +0 and x is +0 +---*/ + +assert.sameValue(Math.atan2(0, 0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.js new file mode 100644 index 0000000000..ff48e85564 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A8.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. + +/*--- +info: If y is equal to -0 and x>0, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A8 +description: Checking if Math.atan2(y,x) is -0, where y is equal to -0 and x>0 +---*/ + +// CHECK#1 +var y = -0; +var x = new Array(); +x[0] = 0.000000000000001; +x[2] = +Infinity; +x[1] = 1; +var xnum = 3; + +for (var i = 0; i < xnum; i++) +{ + assert.sameValue( + Math.atan2(y, x[i]), + -0, + "(-0, " + x[i] + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js new file mode 100644 index 0000000000..8977e1a516 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/S15.8.2.5_A9.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -0 and x is +0, Math.atan2(y,x) is -0 +es5id: 15.8.2.5_A9 +description: Checking if Math.atan2(y,x) is -0, where y is -0 and x is +0 +---*/ + +assert.sameValue(Math.atan2(-0, 0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/browser.js b/js/src/tests/test262/built-ins/Math/atan2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/atan2/length.js b/js/src/tests/test262/built-ins/Math/atan2/length.js new file mode 100644 index 0000000000..8255c76783 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.8 +description: > + Math.atan2.length is 2. +info: | + Math.atan2 ( y, x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atan2.length, 2); + +verifyNotEnumerable(Math.atan2, "length"); +verifyNotWritable(Math.atan2, "length"); +verifyConfigurable(Math.atan2, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/name.js b/js/src/tests/test262/built-ins/Math/atan2/name.js new file mode 100644 index 0000000000..fef201b98d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.8 +description: > + Math.atan2.name is "atan2". +info: | + Math.atan2 ( y, x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atan2.name, "atan2"); + +verifyNotEnumerable(Math.atan2, "name"); +verifyNotWritable(Math.atan2, "name"); +verifyConfigurable(Math.atan2, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js new file mode 100644 index 0000000000..3b8989dd32 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.atan2 does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.atan2), false, 'isConstructor(Math.atan2) must return false'); + +assert.throws(TypeError, () => { + new Math.atan2(); +}, '`new Math.atan2()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js b/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js new file mode 100644 index 0000000000..4a97d06011 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.atan2 +description: > + "atan2" property of Math +info: | + Section 17: 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(Math, "atan2"); +verifyWritable(Math, "atan2"); +verifyConfigurable(Math, "atan2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atan2/shell.js b/js/src/tests/test262/built-ins/Math/atan2/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atan2/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js b/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js new file mode 100644 index 0000000000..2dc767ff6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/atanh-specialVals.js @@ -0,0 +1,33 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.atanh with special values +es6id: 20.2.2.7 +---*/ + +assert.sameValue(Math.atanh(-1.9), Number.NaN, + "Math.atanh produces incorrect output for -1.9"); +assert.sameValue(Math.atanh(NaN), Number.NaN, + "Math.atanh produces incorrect output for NaN"); +assert.sameValue(Math.atanh(-10), Number.NaN, + "Math.atanh produces incorrect output for -10"); +assert.sameValue(Math.atanh(-Infinity), Number.NaN, + "Math.atanh produces incorrect output for -Infinity"); +assert.sameValue(Math.atanh(1.9), Number.NaN, + "Math.atanh produces incorrect output for 1.9"); +assert.sameValue(Math.atanh(10), Number.NaN, + "Math.atanh produces incorrect output for 10"); +assert.sameValue(Math.atanh(Number.POSITIVE_INFINITY), Number.NaN, + "Math.atanh produces incorrect output for Number.POSITIVE_INFINITY"); + +assert.sameValue(Math.atanh(-1), Number.NEGATIVE_INFINITY, + "Math.atanh should produce negative infinity for -1"); +assert.sameValue(Math.atanh(+1), Number.POSITIVE_INFINITY, + "Math.atanh should produce positive infinity for +1"); +assert.sameValue(1 / Math.atanh(-0), Number.NEGATIVE_INFINITY, + "Math.atanh should produce -0 for -0"); +assert.sameValue(1 / Math.atanh(0), Number.POSITIVE_INFINITY, + "Math.atanh should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atanh/browser.js b/js/src/tests/test262/built-ins/Math/atanh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/atanh/length.js b/js/src/tests/test262/built-ins/Math/atanh/length.js new file mode 100644 index 0000000000..7836a19735 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.atanh +es6id: 20.2.2.7 +info: | + Math.atanh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atanh.length, 1); + +verifyNotEnumerable(Math.atanh, "length"); +verifyNotWritable(Math.atanh, "length"); +verifyConfigurable(Math.atanh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atanh/name.js b/js/src/tests/test262/built-ins/Math/atanh/name.js new file mode 100644 index 0000000000..f62a0884df --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.7 +description: > + Math.atanh.name is "atanh". +info: | + Math.atanh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.atanh.name, "atanh"); + +verifyNotEnumerable(Math.atanh, "name"); +verifyNotWritable(Math.atanh, "name"); +verifyConfigurable(Math.atanh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js new file mode 100644 index 0000000000..1dd566de55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.atanh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.atanh), false, 'isConstructor(Math.atanh) must return false'); + +assert.throws(TypeError, () => { + new Math.atanh(); +}, '`new Math.atanh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atanh/prop-desc.js b/js/src/tests/test262/built-ins/Math/atanh/prop-desc.js new file mode 100644 index 0000000000..e9335830bf --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.atanh +includes: [propertyHelper.js] +es6id: 20.2.2.7 +---*/ + +verifyNotEnumerable(Math, "atanh"); +verifyWritable(Math, "atanh"); +verifyConfigurable(Math, "atanh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/atanh/shell.js b/js/src/tests/test262/built-ins/Math/atanh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/atanh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/browser.js b/js/src/tests/test262/built-ins/Math/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/cbrt/browser.js b/js/src/tests/test262/built-ins/Math/cbrt/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js b/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js new file mode 100644 index 0000000000..c31dc1a2a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/cbrt-specialValues.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.cbrt with special values +es6id: 20.2.2.9 +---*/ + +assert.sameValue(Math.cbrt(NaN), Number.NaN, + "Math.cbrt produces incorrect output for NaN"); +assert.sameValue(Math.cbrt(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, + "Math.cbrt should produce negative infinity for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.cbrt(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.cbrt should produce positive infinity for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.cbrt(-0), Number.NEGATIVE_INFINITY, + "Math.cbrt should produce -0 for -0"); +assert.sameValue(1 / Math.cbrt(0), Number.POSITIVE_INFINITY, + "Math.cbrt should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cbrt/length.js b/js/src/tests/test262/built-ins/Math/cbrt/length.js new file mode 100644 index 0000000000..254fc702d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.cbrt +es6id: 20.2.2.9 +info: | + Math.cbrt ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cbrt.length, 1); + +verifyNotEnumerable(Math.cbrt, "length"); +verifyNotWritable(Math.cbrt, "length"); +verifyConfigurable(Math.cbrt, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cbrt/name.js b/js/src/tests/test262/built-ins/Math/cbrt/name.js new file mode 100644 index 0000000000..d6262036b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.9 +description: > + Math.cbrt.name is "cbrt". +info: | + Math.cbrt ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cbrt.name, "cbrt"); + +verifyNotEnumerable(Math.cbrt, "name"); +verifyNotWritable(Math.cbrt, "name"); +verifyConfigurable(Math.cbrt, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js new file mode 100644 index 0000000000..39b62b8f1c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.cbrt does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.cbrt), false, 'isConstructor(Math.cbrt) must return false'); + +assert.throws(TypeError, () => { + new Math.cbrt(); +}, '`new Math.cbrt()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js b/js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js new file mode 100644 index 0000000000..a1848425b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.cbrt +includes: [propertyHelper.js] +es6id: 20.2.2.9 +---*/ + +verifyNotEnumerable(Math, "cbrt"); +verifyWritable(Math, "cbrt"); +verifyConfigurable(Math, "cbrt"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cbrt/shell.js b/js/src/tests/test262/built-ins/Math/cbrt/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cbrt/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A1.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A1.js new file mode 100644 index 0000000000..b2033ef097 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.ceil(x) is NaN +es5id: 15.8.2.6_A1 +description: Checking if Math.ceil(NaN) is NaN +---*/ + +assert.sameValue(Math.ceil(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A2.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A2.js new file mode 100644 index 0000000000..967d755a3b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.ceil(x) is +0 +es5id: 15.8.2.6_A2 +description: Checking if Math.ceil(x) is +0, where x is +0 +---*/ + +assert.sameValue(Math.ceil(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A3.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A3.js new file mode 100644 index 0000000000..a6ffadfe18 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.ceil(x) is -0 +es5id: 15.8.2.6_A3 +description: Checking if Math.ceil(x) is -0, where x is -0 +---*/ + +assert.sameValue(Math.ceil(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A4.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A4.js new file mode 100644 index 0000000000..a7ab010f27 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A4.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. + +/*--- +info: If x is +Infinity, Math.ceil(x) is +Infinity +es5id: 15.8.2.6_A4 +description: Checking if Math.ceil(x) is +Infinity, where x is +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.ceil(x), +Infinity, 'Math.ceil(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A5.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A5.js new file mode 100644 index 0000000000..31f906be45 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A5.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. + +/*--- +info: If x is -Infinity, Math.ceil(x) is -Infinity +es5id: 15.8.2.6_A5 +description: Checking if Math.ceil(x) is -Infinity, where x is -Infinity +---*/ + +// CHECK#1 +var x = -Infinity; +assert.sameValue(Math.ceil(x), -Infinity, 'Math.ceil(-Infinity) must return -Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A6.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A6.js new file mode 100644 index 0000000000..7304f1315d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is less than 0 but greater than -1, Math.ceil(x) is -0 +es5id: 15.8.2.6_A6 +description: > + Checking if Math.ceil(x) is -0, where x is less than 0 but greater + than -1 +---*/ + +assert.sameValue(Math.ceil(-0.000000000000001), -0, "-0.000000000000001"); +assert.sameValue(Math.ceil(-0.999999999999999), -0, "-0.999999999999999"); +assert.sameValue(Math.ceil(-0.5), -0, "-0.5"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A7.js b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A7.js new file mode 100644 index 0000000000..b5e16d9fb6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/S15.8.2.6_A7.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. + +/*--- +info: The value of Math.ceil(x) is the same as the value of -Math.floor(-x) +es5id: 15.8.2.6_A7 +description: > + Checking if Math.ceil(x) equals to -Math.floor(-x) on 2000 + floating point argument values +---*/ + +// CHECK#1 +for (var i = -1000; i < 1000; i++) +{ + var x = i / 10.0; + assert.sameValue(Math.ceil(x), -Math.floor(-x), 'Math.ceil(i / 10.0) must return -Math.floor(-x)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/browser.js b/js/src/tests/test262/built-ins/Math/ceil/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/ceil/length.js b/js/src/tests/test262/built-ins/Math/ceil/length.js new file mode 100644 index 0000000000..c8717de985 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.10 +description: > + Math.ceil.length is 1. +info: | + Math.ceil ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.ceil.length, 1); + +verifyNotEnumerable(Math.ceil, "length"); +verifyNotWritable(Math.ceil, "length"); +verifyConfigurable(Math.ceil, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/name.js b/js/src/tests/test262/built-ins/Math/ceil/name.js new file mode 100644 index 0000000000..df08f67866 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.10 +description: > + Math.ceil.name is "ceil". +info: | + Math.ceil ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.ceil.name, "ceil"); + +verifyNotEnumerable(Math.ceil, "name"); +verifyNotWritable(Math.ceil, "name"); +verifyConfigurable(Math.ceil, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/ceil/not-a-constructor.js new file mode 100644 index 0000000000..8e2861138f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.ceil does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.ceil), false, 'isConstructor(Math.ceil) must return false'); + +assert.throws(TypeError, () => { + new Math.ceil(); +}, '`new Math.ceil()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/prop-desc.js b/js/src/tests/test262/built-ins/Math/ceil/prop-desc.js new file mode 100644 index 0000000000..2f4aef196b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.ceil +description: > + "ceil" property of Math +info: | + Section 17: 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(Math, "ceil"); +verifyWritable(Math, "ceil"); +verifyConfigurable(Math, "ceil"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/ceil/shell.js b/js/src/tests/test262/built-ins/Math/ceil/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/ceil/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/clz32/Math.clz32.js b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32.js new file mode 100644 index 0000000000..d73dec8999 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32.js @@ -0,0 +1,13 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.11 +author: Ryan Lewis +description: Math.clz32 should return 32 if passed 0. +---*/ + +assert.sameValue(Math.clz32(0), 32, 'Math.clz32(0)'); +assert.sameValue(Math.clz32(-0), 32, 'Math.clz32(-0)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_1.js b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_1.js new file mode 100644 index 0000000000..bdae08044f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_1.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.11 +author: Ryan Lewis +description: Math.clz32 should return 31 if passed 1. +---*/ + +assert.sameValue(Math.clz32(1), 31, 'Math.clz32(1)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_2.js b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_2.js new file mode 100644 index 0000000000..b5e2fd8804 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/Math.clz32_2.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.11 +author: Ryan Lewis +description: Math.clz32 should return 0 if passed 2147483648 +---*/ + +assert.sameValue(Math.clz32(2147483648), 0, 'Math.clz32(2147483648)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/browser.js b/js/src/tests/test262/built-ins/Math/clz32/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/clz32/infinity.js b/js/src/tests/test262/built-ins/Math/clz32/infinity.js new file mode 100644 index 0000000000..87c6b6805e --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/infinity.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. + +/*--- +esid: sec-math.clz32 +description: > + Return 32 if x is Infinity or -Infinity +info: | + Math.clz32 ( x ) + + 1. Let n be ToUint32(x). + 2. Let p be the number of leading zero bits in the 32-bit binary representation of n. + 3. Return p. + + 7.1.6 ToUint32 ( argument ) + + [...] + 2. If number is NaN, +0, -0, +∞, or -∞, return +0. + [...] +---*/ + +assert.sameValue(Math.clz32(Infinity), 32, "Infinity"); +assert.sameValue(Math.clz32(-Infinity), 32, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/int32bit.js b/js/src/tests/test262/built-ins/Math/clz32/int32bit.js new file mode 100644 index 0000000000..b1056a6e7f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/int32bit.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.clz32 +description: > + Catches the int32bit value in the ToUint32 operation +info: | + Math.clz32 ( x ) + + 1. Let n be ToUint32(x). + 2. Let p be the number of leading zero bits in the 32-bit binary representation of n. + 3. Return p. + + 7.1.6 ToUint32 ( argument ) + + [...] + 3. Let int be the mathematical value that is the same sign as number and whose + magnitude is floor(abs(number)). + 4. Let int32bit be int modulo 232. + 5. Return int32bit. + [...] +---*/ + +assert.sameValue(Math.clz32(4294967295), 0, "2**32-1"); +assert.sameValue(Math.clz32(4294967296), 32, "2**32"); +assert.sameValue(Math.clz32(4294967297), 31, "2**32+1"); + +assert.sameValue(Math.clz32(65535), 16, "2**16-1"); +assert.sameValue(Math.clz32(65536), 15, "2**16"); +assert.sameValue(Math.clz32(65537), 15, "2**16+1"); + +assert.sameValue(Math.clz32(255), 24, "2**8-1"); +assert.sameValue(Math.clz32(256), 23, "2**8"); +assert.sameValue(Math.clz32(257), 23, "2**8+1"); + +assert.sameValue(Math.clz32(-4294967295), 31, "-(2**32-1)"); +assert.sameValue(Math.clz32(-4294967296), 32, "-(2**32)"); +assert.sameValue(Math.clz32(-4294967297), 0, "-(2**32+1)"); + +assert.sameValue(Math.clz32(-65535), 0, "-(2**16-1)"); +assert.sameValue(Math.clz32(-65536), 0, "-(2**16)"); +assert.sameValue(Math.clz32(-65537), 0, "-(2**16+1)"); + +assert.sameValue(Math.clz32(-255), 0, "-(2**8-1)"); +assert.sameValue(Math.clz32(-256), 0, "-(2**8)"); +assert.sameValue(Math.clz32(-257), 0, "-(2**8+1)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/length.js b/js/src/tests/test262/built-ins/Math/clz32/length.js new file mode 100644 index 0000000000..038975b13d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.11 +description: > + Math.clz32.length is 1. +info: | + Math.clz32 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.clz32.length, 1); + +verifyNotEnumerable(Math.clz32, "length"); +verifyNotWritable(Math.clz32, "length"); +verifyConfigurable(Math.clz32, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/name.js b/js/src/tests/test262/built-ins/Math/clz32/name.js new file mode 100644 index 0000000000..2862f87439 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.11 +description: > + Math.clz32.name is "clz32". +info: | + Math.clz32 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.clz32.name, "clz32"); + +verifyNotEnumerable(Math.clz32, "name"); +verifyNotWritable(Math.clz32, "name"); +verifyConfigurable(Math.clz32, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/nan.js b/js/src/tests/test262/built-ins/Math/clz32/nan.js new file mode 100644 index 0000000000..9f1e044138 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/nan.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.clz32 +description: > + Return 32 if x is NaN +info: | + Math.clz32 ( x ) + + 1. Let n be ToUint32(x). + 2. Let p be the number of leading zero bits in the 32-bit binary representation of n. + 3. Return p. + + 7.1.6 ToUint32 ( argument ) + + [...] + 2. If number is NaN, +0, -0, +∞, or -∞, return +0. + [...] +---*/ + +assert.sameValue(Math.clz32(NaN), 32); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/clz32/not-a-constructor.js new file mode 100644 index 0000000000..2bff88114f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.clz32 does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.clz32), false, 'isConstructor(Math.clz32) must return false'); + +assert.throws(TypeError, () => { + new Math.clz32(); +}, '`new Math.clz32()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/prop-desc.js b/js/src/tests/test262/built-ins/Math/clz32/prop-desc.js new file mode 100644 index 0000000000..96617d887a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.clz32 +description: > + "clz32" property of Math +info: | + Section 17: 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(Math, "clz32"); +verifyWritable(Math, "clz32"); +verifyConfigurable(Math, "clz32"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/clz32/shell.js b/js/src/tests/test262/built-ins/Math/clz32/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/clz32/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A1.js b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A1.js new file mode 100644 index 0000000000..157bb8a147 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.cos(x) is NaN +es5id: 15.8.2.7_A1 +description: Checking if Math.cos(NaN) is NaN +---*/ + +assert.sameValue(Math.cos(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A2.js b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A2.js new file mode 100644 index 0000000000..17ea8f4796 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A2.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. + +/*--- +info: If x is +0, Math.cos(x) is 1 +es5id: 15.8.2.7_A2 +description: Checking if Math.cos(+0) is 1 +---*/ + +// CHECK#1 +var x = +0; +assert.sameValue(Math.cos(x), 1, 'Math.cos(+0) must return 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A3.js b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A3.js new file mode 100644 index 0000000000..51988dbccc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A3.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. + +/*--- +info: If x is -0, Math.cos(x) is 1 +es5id: 15.8.2.7_A3 +description: Checking if Math.cos(-0) is 1 +---*/ + +// CHECK#1 +var x = -0; +assert.sameValue(Math.cos(x), 1, 'Math.cos(-0) must return 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A4.js b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A4.js new file mode 100644 index 0000000000..faaae0a6cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity, Math.cos(x) is NaN +es5id: 15.8.2.7_A4 +description: Checking if Math.cos(+Infinity) is NaN +---*/ + +assert.sameValue(Math.cos(Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A5.js b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A5.js new file mode 100644 index 0000000000..4c02c474b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/S15.8.2.7_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, Math.cos(x) is NaN +es5id: 15.8.2.7_A5 +description: Checking if Math.cos(-Infinity) is NaN +---*/ + +assert.sameValue(Math.cos(-Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/browser.js b/js/src/tests/test262/built-ins/Math/cos/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/cos/length.js b/js/src/tests/test262/built-ins/Math/cos/length.js new file mode 100644 index 0000000000..b41d87ef73 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.12 +description: > + Math.cos.length is 1. +info: | + Math.cos ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cos.length, 1); + +verifyNotEnumerable(Math.cos, "length"); +verifyNotWritable(Math.cos, "length"); +verifyConfigurable(Math.cos, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/name.js b/js/src/tests/test262/built-ins/Math/cos/name.js new file mode 100644 index 0000000000..88be1490d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.12 +description: > + Math.cos.name is "cos". +info: | + Math.cos ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cos.name, "cos"); + +verifyNotEnumerable(Math.cos, "name"); +verifyNotWritable(Math.cos, "name"); +verifyConfigurable(Math.cos, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/cos/not-a-constructor.js new file mode 100644 index 0000000000..e86a689ccb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.cos does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.cos), false, 'isConstructor(Math.cos) must return false'); + +assert.throws(TypeError, () => { + new Math.cos(); +}, '`new Math.cos()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/prop-desc.js b/js/src/tests/test262/built-ins/Math/cos/prop-desc.js new file mode 100644 index 0000000000..91532c0408 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.cos +description: > + "cos" property of Math +info: | + Section 17: 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(Math, "cos"); +verifyWritable(Math, "cos"); +verifyConfigurable(Math, "cos"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cos/shell.js b/js/src/tests/test262/built-ins/Math/cos/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cos/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/cosh/browser.js b/js/src/tests/test262/built-ins/Math/cosh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js b/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js new file mode 100644 index 0000000000..1c78047259 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/cosh-specialVals.js @@ -0,0 +1,18 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.cosh with special values +es6id: 20.2.2.13 +---*/ + +assert.sameValue(Math.cosh(NaN), Number.NaN, + "Math.cosh produces incorrect output for NaN"); +assert.sameValue(Math.cosh(0), 1, "Math.cosh should produce 1 for input = 0"); +assert.sameValue(Math.cosh(-0), 1, "Math.cosh should produce 1 for input = -0"); +assert.sameValue(Math.cosh(Number.NEGATIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.cosh should produce Number.POSITIVE_INFINITY for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.cosh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.cosh should produce Number.POSITIVE_INFINITY for Number.POSITIVE_INFINITY"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/length.js b/js/src/tests/test262/built-ins/Math/cosh/length.js new file mode 100644 index 0000000000..6c64935887 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.13 +description: Length property of Math.cosh is 1 +info: | + Math.cosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cosh.length, 1); + +verifyNotEnumerable(Math.cosh, "length"); +verifyNotWritable(Math.cosh, "length"); +verifyConfigurable(Math.cosh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/name.js b/js/src/tests/test262/built-ins/Math/cosh/name.js new file mode 100644 index 0000000000..161ed02e3a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.13 +description: > + Math.cosh.name is "cosh". +info: | + Math.cosh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.cosh.name, "cosh"); + +verifyNotEnumerable(Math.cosh, "name"); +verifyNotWritable(Math.cosh, "name"); +verifyConfigurable(Math.cosh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js new file mode 100644 index 0000000000..8cda77d866 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.cosh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.cosh), false, 'isConstructor(Math.cosh) must return false'); + +assert.throws(TypeError, () => { + new Math.cosh(); +}, '`new Math.cosh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js b/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js new file mode 100644 index 0000000000..babc6f8380 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.cosh +includes: [propertyHelper.js] +es6id: 20.2.2.13 +---*/ + +verifyNotEnumerable(Math, "cosh"); +verifyWritable(Math, "cosh"); +verifyConfigurable(Math, "cosh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/cosh/shell.js b/js/src/tests/test262/built-ins/Math/cosh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/cosh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A1.js b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A1.js new file mode 100644 index 0000000000..a67441ece2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.exp(x) is NaN +es5id: 15.8.2.8_A1 +description: Checking if Math.exp(NaN) is NaN +---*/ + +assert.sameValue(Math.exp(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A2.js b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A2.js new file mode 100644 index 0000000000..66e694b3e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A2.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. + +/*--- +info: If x is +0, Math.exp(x) is 1 +es5id: 15.8.2.8_A2 +description: Checking if Math.exp(+0) is 1 +---*/ + +// CHECK#1 +var x = +0; +assert.sameValue(Math.exp(x), 1, 'Math.exp(+0) must return 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A3.js b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A3.js new file mode 100644 index 0000000000..3b0d7a8ef2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A3.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. + +/*--- +info: If x is -0, Math.exp(x) is 1 +es5id: 15.8.2.8_A3 +description: Checking if Math.exp(-0) is 1 +---*/ + +// CHECK#1 +var x = -0; +assert.sameValue(Math.exp(x), 1, 'Math.exp(-0) must return 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A4.js b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A4.js new file mode 100644 index 0000000000..b4d8983136 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A4.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. + +/*--- +info: If x is +Infinity, Math.exp(x) is +Ifinity +es5id: 15.8.2.8_A4 +description: Checking if Math.exp(+Infinity) is +Ifinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.exp(x), +Infinity, 'Math.exp(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A5.js b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A5.js new file mode 100644 index 0000000000..2506e07514 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/S15.8.2.8_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, Math.exp(x) is +0 +es5id: 15.8.2.8_A5 +description: Checking if Math.exp(-Infinity) is +0 +---*/ + +assert.sameValue(Math.exp(-Infinity), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/browser.js b/js/src/tests/test262/built-ins/Math/exp/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/exp/length.js b/js/src/tests/test262/built-ins/Math/exp/length.js new file mode 100644 index 0000000000..1f90dbf228 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.14 +description: > + Math.exp.length is 1. +info: | + Math.exp ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.exp.length, 1); + +verifyNotEnumerable(Math.exp, "length"); +verifyNotWritable(Math.exp, "length"); +verifyConfigurable(Math.exp, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/name.js b/js/src/tests/test262/built-ins/Math/exp/name.js new file mode 100644 index 0000000000..9f0ec90ebb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.14 +description: > + Math.exp.name is "exp". +info: | + Math.exp ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.exp.name, "exp"); + +verifyNotEnumerable(Math.exp, "name"); +verifyNotWritable(Math.exp, "name"); +verifyConfigurable(Math.exp, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/exp/not-a-constructor.js new file mode 100644 index 0000000000..9d956e7bcb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.exp does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.exp), false, 'isConstructor(Math.exp) must return false'); + +assert.throws(TypeError, () => { + new Math.exp(); +}, '`new Math.exp()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/prop-desc.js b/js/src/tests/test262/built-ins/Math/exp/prop-desc.js new file mode 100644 index 0000000000..d63d3d3d8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.exp +description: > + "exp" property of Math +info: | + Section 17: 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(Math, "exp"); +verifyWritable(Math, "exp"); +verifyConfigurable(Math, "exp"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/exp/shell.js b/js/src/tests/test262/built-ins/Math/exp/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/exp/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/expm1/browser.js b/js/src/tests/test262/built-ins/Math/expm1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js b/js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js new file mode 100644 index 0000000000..10c9329a59 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/expm1-specialVals.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.expm1 with sample values. +es6id: 20.2.2.15 +---*/ + +assert.sameValue(Math.expm1(NaN), Number.NaN, + "Math.expm1 produces incorrect output for NaN"); +assert.sameValue(Math.expm1(Number.NEGATIVE_INFINITY), -1, + "Math.expm1 should produce -1 for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.expm1(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.expm1 should produce POSITIVE infinity for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.expm1(-0), Number.NEGATIVE_INFINITY, + "Math.expm1 should produce -0 for -0"); +assert.sameValue(1 / Math.expm1(0), Number.POSITIVE_INFINITY, + "Math.expm1 should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/expm1/length.js b/js/src/tests/test262/built-ins/Math/expm1/length.js new file mode 100644 index 0000000000..ead3c57638 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.expm1 +es6id: 20.2.2.15 +info: | + Math.expm1 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.expm1.length, 1); + +verifyNotEnumerable(Math.expm1, "length"); +verifyNotWritable(Math.expm1, "length"); +verifyConfigurable(Math.expm1, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/expm1/name.js b/js/src/tests/test262/built-ins/Math/expm1/name.js new file mode 100644 index 0000000000..698bdc19c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.15 +description: > + Math.expm1.name is "expm1". +info: | + Math.expm1 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.expm1.name, "expm1"); + +verifyNotEnumerable(Math.expm1, "name"); +verifyNotWritable(Math.expm1, "name"); +verifyConfigurable(Math.expm1, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js new file mode 100644 index 0000000000..d0b9a18935 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.expm1 does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.expm1), false, 'isConstructor(Math.expm1) must return false'); + +assert.throws(TypeError, () => { + new Math.expm1(); +}, '`new Math.expm1()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/expm1/prop-desc.js b/js/src/tests/test262/built-ins/Math/expm1/prop-desc.js new file mode 100644 index 0000000000..cf0a3bd6b3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.expm1 +includes: [propertyHelper.js] +es6id: 20.2.2.15 +---*/ + +verifyNotEnumerable(Math, "expm1"); +verifyWritable(Math, "expm1"); +verifyConfigurable(Math, "expm1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/expm1/shell.js b/js/src/tests/test262/built-ins/Math/expm1/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/expm1/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A1.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A1.js new file mode 100644 index 0000000000..01175969e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.floor(x) is NaN +es5id: 15.8.2.9_A1 +description: Checking if Math.floor(NaN) is NaN +---*/ + +assert.sameValue(Math.floor(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A2.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A2.js new file mode 100644 index 0000000000..497cec4306 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.floor(x) is +0 +es5id: 15.8.2.9_A2 +description: Checking if Math.floor(x) is +0, where x is +0 +---*/ + +assert.sameValue(Math.floor(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A3.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A3.js new file mode 100644 index 0000000000..cb473f917f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.floor(x) is -0 +es5id: 15.8.2.9_A3 +description: Checking if Math.floor(x) is -0, where x is -0 +---*/ + +assert.sameValue(Math.floor(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A4.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A4.js new file mode 100644 index 0000000000..4fd94629fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A4.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. + +/*--- +info: If x is +Infinity, Math.floor(x) is +Infinity +es5id: 15.8.2.9_A4 +description: Checking if Math.floor(x) is +Infinity, where x is +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.floor(x), +Infinity, 'Math.floor(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A5.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A5.js new file mode 100644 index 0000000000..619e760c45 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A5.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. + +/*--- +info: If x is -Infinity, Math.floor(x) is -Infinity +es5id: 15.8.2.9_A5 +description: Checking if Math.floor(x) is -Infinity, where x is -Infinity +---*/ + +// CHECK#1 +var x = -Infinity; +assert.sameValue(Math.floor(x), -Infinity, 'Math.floor(-Infinity) must return -Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A6.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A6.js new file mode 100644 index 0000000000..0c8e0c7138 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is greater than 0 but less than 1, Math.floor(x) is +0 +es5id: 15.8.2.9_A6 +description: > + Checking if Math.floor(x) is +0, where x is greater than 0 but + less than 1 +---*/ + +assert.sameValue(Math.floor(0.000000000000001), 0, "0.000000000000001"); +assert.sameValue(Math.floor(0.999999999999999), 0, "0.999999999999999"); +assert.sameValue(Math.floor(0.5), 0, "0.5"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A7.js b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A7.js new file mode 100644 index 0000000000..d14ebc208c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/S15.8.2.9_A7.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The value of Math.floor(x) is the same as the value of -Math.ceil(-x) +es5id: 15.8.2.9_A7 +description: > + Checking if Math.floor(x) is equal to -Math.ceil(-x) on 2000 + floating-point argument values +---*/ + +// CHECK#1 +for (var i = -1000; i < 1000; i++) +{ + var x = i / 10.0; + + assert.sameValue( + -Math.ceil(-x), + Math.floor(x), + 'The value of `-Math.ceil(-x)` must return the same value returned by Math.floor(x)' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/browser.js b/js/src/tests/test262/built-ins/Math/floor/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/floor/length.js b/js/src/tests/test262/built-ins/Math/floor/length.js new file mode 100644 index 0000000000..ee66afc021 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.16 +description: > + Math.floor.length is 1. +info: | + Math.floor ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.floor.length, 1); + +verifyNotEnumerable(Math.floor, "length"); +verifyNotWritable(Math.floor, "length"); +verifyConfigurable(Math.floor, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/name.js b/js/src/tests/test262/built-ins/Math/floor/name.js new file mode 100644 index 0000000000..4b08a81688 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.16 +description: > + Math.floor.name is "floor". +info: | + Math.floor ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.floor.name, "floor"); + +verifyNotEnumerable(Math.floor, "name"); +verifyNotWritable(Math.floor, "name"); +verifyConfigurable(Math.floor, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/floor/not-a-constructor.js new file mode 100644 index 0000000000..140a726d16 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.floor does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.floor), false, 'isConstructor(Math.floor) must return false'); + +assert.throws(TypeError, () => { + new Math.floor(); +}, '`new Math.floor()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/prop-desc.js b/js/src/tests/test262/built-ins/Math/floor/prop-desc.js new file mode 100644 index 0000000000..7e2434480d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.floor +description: > + "floor" property of Math +info: | + Section 17: 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(Math, "floor"); +verifyWritable(Math, "floor"); +verifyConfigurable(Math, "floor"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/floor/shell.js b/js/src/tests/test262/built-ins/Math/floor/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/floor/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/fround/Math.fround_Infinity.js b/js/src/tests/test262/built-ins/Math/fround/Math.fround_Infinity.js new file mode 100644 index 0000000000..07230c73ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/Math.fround_Infinity.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.17 +author: Ryan Lewis +description: Math.fround should return Infinity if called with Infinity. +---*/ + +assert.sameValue(Math.fround(Infinity), Infinity, 'Math.fround(Infinity)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/Math.fround_NaN.js b/js/src/tests/test262/built-ins/Math/fround/Math.fround_NaN.js new file mode 100644 index 0000000000..6b17546e51 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/Math.fround_NaN.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.17 +author: Ryan Lewis +description: Math.fround should return NaN if called with NaN. +---*/ + +assert.sameValue(Math.fround(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/Math.fround_Zero.js b/js/src/tests/test262/built-ins/Math/fround/Math.fround_Zero.js new file mode 100644 index 0000000000..a5dc6fd1df --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/Math.fround_Zero.js @@ -0,0 +1,13 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.17 +author: Ryan Lewis +description: Math.fround should return arg if called with 0 or -0. +---*/ + +assert.sameValue(Math.fround(0), 0, 'Math.fround(0)'); +assert.sameValue(Math.fround(-0), -0, 'Math.fround(-0)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/browser.js b/js/src/tests/test262/built-ins/Math/fround/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/fround/length.js b/js/src/tests/test262/built-ins/Math/fround/length.js new file mode 100644 index 0000000000..56190466ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.17 +description: > + Math.fround.length is 1. +info: | + Math.fround ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.fround.length, 1); + +verifyNotEnumerable(Math.fround, "length"); +verifyNotWritable(Math.fround, "length"); +verifyConfigurable(Math.fround, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/name.js b/js/src/tests/test262/built-ins/Math/fround/name.js new file mode 100644 index 0000000000..c1f5ac6270 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.17 +description: > + Math.fround.name is "fround". +info: | + Math.fround ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.fround.name, "fround"); + +verifyNotEnumerable(Math.fround, "name"); +verifyNotWritable(Math.fround, "name"); +verifyConfigurable(Math.fround, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/fround/not-a-constructor.js new file mode 100644 index 0000000000..d82e346651 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.fround does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.fround), false, 'isConstructor(Math.fround) must return false'); + +assert.throws(TypeError, () => { + new Math.fround(); +}, '`new Math.fround()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/prop-desc.js b/js/src/tests/test262/built-ins/Math/fround/prop-desc.js new file mode 100644 index 0000000000..6d58e1e118 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.fround +description: > + "fround" property of Math +info: | + Section 17: 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(Math, "fround"); +verifyWritable(Math, "fround"); +verifyConfigurable(Math, "fround"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/shell.js b/js/src/tests/test262/built-ins/Math/fround/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/fround/ties.js b/js/src/tests/test262/built-ins/Math/fround/ties.js new file mode 100644 index 0000000000..5fdb467369 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/ties.js @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Tiancheng "Timothy" Gu. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-math.fround +description: Math.fround should use roundTiesToEven for conversion to binary32. +---*/ + +// We test five values against Math.fround, with their binary64 representation +// shown: +// a0 := 1.0 = 0x1p+0 +// a1 := 1.0000000596046448 = 0x1.000001p+0 +// a2 := 1.0000001192092896 = 0x1.000002p+0 +// a3 := 1.0000001788139343 = 0x1.000003p+0 +// a4 := 1.000000238418579 = 0x1.000004p+0 +// a5 := 1.0000002980232239 = 0x1.000005p+0 +// a6 := 1.0000003576278687 = 0x1.000006p+0 +// (Note: they are separated by 2 ** -24.) +// +// a0, a2, a4, and a6 are all representable exactly in binary32; however, while +// a0 and a4 have even mantissas in binary32, a2 and a6 have an odd mantissa +// when represented in that way. +// +// a1 is exactly halfway between a0 and a2, a3 between a2 and a4, and a5 +// between a4 and a6. By roundTiesToEven, Math.fround should favor a0 and a4 +// over a2 when they are equally close, and a4 over a6 when they are equally +// close. + +var a0 = 1.0; +var a1 = 1.0000000596046448; +var a2 = 1.0000001192092896; +var a3 = 1.0000001788139343; +var a4 = 1.000000238418579; +var a5 = 1.0000002980232239; +var a6 = 1.0000003576278687; + +assert.sameValue(Math.fround(a0), a0, 'Math.fround(a0)'); +assert.sameValue(Math.fround(a1), a0, 'Math.fround(a1)'); +assert.sameValue(Math.fround(a2), a2, 'Math.fround(a2)'); +assert.sameValue(Math.fround(a3), a4, 'Math.fround(a3)'); +assert.sameValue(Math.fround(a4), a4, 'Math.fround(a4)'); +assert.sameValue(Math.fround(a5), a4, 'Math.fround(a5)'); +assert.sameValue(Math.fround(a6), a6, 'Math.fround(a6)'); + +assert.sameValue(Math.fround(-a0), -a0, 'Math.fround(-a0)'); +assert.sameValue(Math.fround(-a1), -a0, 'Math.fround(-a1)'); +assert.sameValue(Math.fround(-a2), -a2, 'Math.fround(-a2)'); +assert.sameValue(Math.fround(-a3), -a4, 'Math.fround(-a3)'); +assert.sameValue(Math.fround(-a4), -a4, 'Math.fround(-a4)'); +assert.sameValue(Math.fround(-a5), -a4, 'Math.fround(-a5)'); +assert.sameValue(Math.fround(-a6), -a6, 'Math.fround(-a6)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/fround/value-convertion.js b/js/src/tests/test262/built-ins/Math/fround/value-convertion.js new file mode 100644 index 0000000000..98e6b9d4a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/fround/value-convertion.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.fround +description: > + Convert to binary32 format and than to binary64 format +info: | + Math.fround ( x ) + + [...] + 3. Let x32 be the result of converting x to a value in IEEE 754-2008 binary32 + format using roundTiesToEven. + 4. Let x64 be the result of converting x32 to a value in IEEE 754-2008 + binary64 format. + 5. Return the ECMAScript Number value corresponding to x64. +---*/ + +assert.sameValue(Math.fround(4294967295), 4294967296, "2**32-1"); +assert.sameValue(Math.fround(4294967296), 4294967296, "2**32"); +assert.sameValue(Math.fround(4294967297), 4294967296, "2**32+1"); + +assert.sameValue(Math.fround(0.1), 0.10000000149011612, "0.1"); +assert.sameValue(Math.fround(0.2), 0.20000000298023224, "0.2"); +assert.sameValue(Math.fround(0.5), 0.5, "0.5"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js new file mode 100644 index 0000000000..b1044692b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Infinity.js @@ -0,0 +1,14 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: > + Math.hypot should return Infinity if called with any argument that + is Infinity. +---*/ + +assert.sameValue(Math.hypot(3, Infinity), Infinity, 'Math.hypot(3, Infinity)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js new file mode 100644 index 0000000000..d06561cdd2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_InfinityNaN.js @@ -0,0 +1,14 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: > + Math.hypot should return Infinity if called with any argument that + is Infinity. +---*/ + +assert.sameValue(Math.hypot(NaN, Infinity), Infinity, 'Math.hypot(NaN, Infinity)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js new file mode 100644 index 0000000000..36260e96f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NaN.js @@ -0,0 +1,14 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: > + Math.hypot should return NaN if called with any argument that is + NaN. +---*/ + +assert.sameValue(Math.hypot(NaN, 3), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js new file mode 100644 index 0000000000..5c4dd8566b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NegInfinity.js @@ -0,0 +1,14 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: > + Math.hypot should return Infinity if called with any argument that + is -Infinity. +---*/ + +assert.sameValue(Math.hypot(3, -Infinity), Infinity, 'Math.hypot(3, -Infinity)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js new file mode 100644 index 0000000000..328fd8de43 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_NoArgs.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: Math.hypot should return 0 if called with no arguments. +---*/ + +assert.sameValue(Math.hypot(), 0, 'Math.hypot()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js new file mode 100644 index 0000000000..15fcca9749 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Success_2.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: Math.hypot should return 5 if called with 3 and 4. +---*/ + +assert.sameValue(Math.hypot(3, 4), 5, 'Math.hypot(3,4)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_ToNumberErr.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_ToNumberErr.js new file mode 100644 index 0000000000..ae2fc40f1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_ToNumberErr.js @@ -0,0 +1,37 @@ +// Copyright (c) 2021 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Math.hypot should coerce all arguments before inspecting them. +esid: sec-math.hypot +info: | + 1. Let _coerced_ be a new empty List. + 2. For each element _arg_ of _args_, do + a. Let _n_ be ? ToNumber(_arg_). + b. Append _n_ to _coerced_. + 3. For each element _number_ of _coerced_, do +---*/ + +var counter = 0; + +assert.throws( + Test262Error, + function() { + Math.hypot( + Infinity, + -Infinity, + NaN, + 0, + -0, + {valueOf: function(){ throw new Test262Error(); }}, + {valueOf: function(){ counter++; }} + ); + }, + 'Math.hypot propagates an abrupt completion from coercing an argument to Number' +); + +assert.sameValue(counter, 0, + 'Math.hypot aborts argument processing at the first abrupt completion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js new file mode 100644 index 0000000000..0e121bd021 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/Math.hypot_Zero_2.js @@ -0,0 +1,19 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.hypot +es6id: 20.2.2.18 +author: Ryan Lewis +description: Math.hypot should return 0 if all arguments are 0 or -0. +---*/ + +assert.sameValue(Math.hypot(0), 0, 'Math.hypot(0)'); +assert.sameValue(Math.hypot(-0), 0, 'Math.hypot(-0)'); +assert.sameValue(Math.hypot(0, 0), 0, 'Math.hypot(0, 0)'); +assert.sameValue(Math.hypot(0, -0), 0, 'Math.hypot(0, -0)'); +assert.sameValue(Math.hypot(-0, 0), 0, 'Math.hypot(-0, 0)'); +assert.sameValue(Math.hypot(-0, -0), 0, 'Math.hypot(-0, -0)'); +assert.sameValue(Math.hypot(0, -0, -0), 0, 'Math.hypot(0, -0, -0)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/browser.js b/js/src/tests/test262/built-ins/Math/hypot/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/hypot/length.js b/js/src/tests/test262/built-ins/Math/hypot/length.js new file mode 100644 index 0000000000..9800debc1a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/length.js @@ -0,0 +1,31 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +author: Ryan Lewis +description: Math.hypot.length should return 2. +info: | + Math.hypot ( value1, value2, ...values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.hypot.length, 2); + +verifyNotEnumerable(Math.hypot, "length"); +verifyNotWritable(Math.hypot, "length"); +verifyConfigurable(Math.hypot, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/name.js b/js/src/tests/test262/built-ins/Math/hypot/name.js new file mode 100644 index 0000000000..46d395ca06 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.18 +description: > + Math.hypot.name is "hypot". +info: | + Math.hypot ( value1 , value2 , …values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.hypot.name, "hypot"); + +verifyNotEnumerable(Math.hypot, "name"); +verifyNotWritable(Math.hypot, "name"); +verifyConfigurable(Math.hypot, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js new file mode 100644 index 0000000000..21ff4ba634 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.hypot does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.hypot), false, 'isConstructor(Math.hypot) must return false'); + +assert.throws(TypeError, () => { + new Math.hypot(); +}, '`new Math.hypot()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/prop-desc.js b/js/src/tests/test262/built-ins/Math/hypot/prop-desc.js new file mode 100644 index 0000000000..3161342511 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.hypot +includes: [propertyHelper.js] +es6id: 20.2.2.18 +---*/ + +verifyNotEnumerable(Math, "hypot"); +verifyWritable(Math, "hypot"); +verifyConfigurable(Math, "hypot"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/hypot/shell.js b/js/src/tests/test262/built-ins/Math/hypot/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/hypot/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/imul/browser.js b/js/src/tests/test262/built-ins/Math/imul/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/imul/length.js b/js/src/tests/test262/built-ins/Math/imul/length.js new file mode 100644 index 0000000000..e457fa6151 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.19 +description: length property of Math.imul +info: | + Math.imul ( x, y ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.imul.length, 2); + +verifyNotEnumerable(Math.imul, "length"); +verifyNotWritable(Math.imul, "length"); +verifyConfigurable(Math.imul, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/imul/name.js b/js/src/tests/test262/built-ins/Math/imul/name.js new file mode 100644 index 0000000000..46ed5dde63 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.19 +description: > + Math.imul.name is "imul". +info: | + Math.imul ( x, y ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.imul.name, "imul"); + +verifyNotEnumerable(Math.imul, "name"); +verifyNotWritable(Math.imul, "name"); +verifyConfigurable(Math.imul, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/imul/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/imul/not-a-constructor.js new file mode 100644 index 0000000000..000f83ab72 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.imul does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.imul), false, 'isConstructor(Math.imul) must return false'); + +assert.throws(TypeError, () => { + new Math.imul(); +}, '`new Math.imul()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/imul/prop-desc.js b/js/src/tests/test262/built-ins/Math/imul/prop-desc.js new file mode 100644 index 0000000000..695a24401d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.imul +includes: [propertyHelper.js] +es6id: 20.2.2.19 +---*/ + +verifyNotEnumerable(Math, "imul"); +verifyWritable(Math, "imul"); +verifyConfigurable(Math, "imul"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/imul/results.js b/js/src/tests/test262/built-ins/Math/imul/results.js new file mode 100644 index 0000000000..f67171191a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/results.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.imul +description: > + Return results +info: | + Math.imul ( x, y ) + + 1. Let a be ToUint32(x). + 2. Let b be ToUint32(y). + 3. Let product be (a × b) modulo 232. + 4. If product ≥ 231, return product - 232; otherwise return product. +---*/ + +assert.sameValue(Math.imul(2, 4), 8, "(2, 4)"); +assert.sameValue(Math.imul(-1, 8), -8, "(-1, 8)"); +assert.sameValue(Math.imul(-2, -2), 4, "(-2, -2)"); +assert.sameValue(Math.imul(0xffffffff, 5), -5, "(0xffffffff, 5)"); +assert.sameValue(Math.imul(0xfffffffe, 5), -10, "(0xfffffffe, 5)"); + +assert.sameValue(Math.imul(-0, 7), 0); +assert.sameValue(Math.imul(7, -0), 0); + +assert.sameValue(Math.imul(0.1, 7), 0); +assert.sameValue(Math.imul(7, 0.1), 0); +assert.sameValue(Math.imul(0.9, 7), 0); +assert.sameValue(Math.imul(7, 0.9), 0); +assert.sameValue(Math.imul(1.1, 7), 7); +assert.sameValue(Math.imul(7, 1.1), 7); +assert.sameValue(Math.imul(1.9, 7), 7); +assert.sameValue(Math.imul(7, 1.9), 7); + +assert.sameValue(Math.imul(1073741824, 7), -1073741824); +assert.sameValue(Math.imul(7, 1073741824), -1073741824); +assert.sameValue(Math.imul(1073741824, 1073741824), 0); + +assert.sameValue(Math.imul(-1073741824, 7), 1073741824); +assert.sameValue(Math.imul(7, -1073741824), 1073741824); +assert.sameValue(Math.imul(-1073741824, -1073741824), 0); + +assert.sameValue(Math.imul(2147483648, 7), -2147483648); +assert.sameValue(Math.imul(7, 2147483648), -2147483648); +assert.sameValue(Math.imul(2147483648, 2147483648), 0); + +assert.sameValue(Math.imul(-2147483648, 7), -2147483648); +assert.sameValue(Math.imul(7, -2147483648), -2147483648); +assert.sameValue(Math.imul(-2147483648, -2147483648), 0); + +assert.sameValue(Math.imul(2147483647, 7), 2147483641); +assert.sameValue(Math.imul(7, 2147483647), 2147483641); +assert.sameValue(Math.imul(2147483647, 2147483647), 1); + +assert.sameValue(Math.imul(65536, 65536), 0); +assert.sameValue(Math.imul(65535, 65536), -65536); +assert.sameValue(Math.imul(65536, 65535), -65536); +assert.sameValue(Math.imul(65535, 65535), -131071); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/imul/shell.js b/js/src/tests/test262/built-ins/Math/imul/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/imul/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A1.js b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A1.js new file mode 100644 index 0000000000..61e2ee7be7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.log(x) is NaN +es5id: 15.8.2.10_A1 +description: Checking if Math.log(NaN) is NaN +---*/ + +assert.sameValue(Math.log(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A2.js b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A2.js new file mode 100644 index 0000000000..7793f4d1ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A2.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. + +/*--- +info: If x is less than 0, Math.log(x) is NaN +es5id: 15.8.2.10_A2 +description: Checking if Math.log(x) is NaN, where x is less than 0 +---*/ + +assert.sameValue(Math.log(-0.000000000000001), NaN, "-0.000000000000001"); +assert.sameValue(Math.log(-1), NaN, "-1"); +assert.sameValue(Math.log(-Infinity), NaN, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A3.js b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A3.js new file mode 100644 index 0000000000..3f469994af --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0 or -0, Math.log(x) is -Infinity +es5id: 15.8.2.10_A3 +description: Checking if Math.log(+0) and Math.log(-0) equals to -Infinity +---*/ + +// CHECK#1 +var x = +0; +assert.sameValue(Math.log(x), -Infinity, 'Math.log(+0) must return -Infinity'); + +// CHECK#2 +var x = -0; +assert.sameValue(Math.log(x), -Infinity, 'Math.log(-0) must return -Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A4.js b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A4.js new file mode 100644 index 0000000000..2fb9cefd33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is 1, Math.log(x) is +0 +es5id: 15.8.2.10_A4 +description: Checking if Math.log(1) equals to +0 +---*/ + +assert.sameValue(Math.log(1), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A5.js b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A5.js new file mode 100644 index 0000000000..c149b2fbed --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/S15.8.2.10_A5.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. + +/*--- +info: If x is +Infinity, Math.log(x) is +Infinity +es5id: 15.8.2.10_A5 +description: Checking if Math.log(+Infinity) equals to +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.log(x), +Infinity, 'Math.log(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/browser.js b/js/src/tests/test262/built-ins/Math/log/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/log/length.js b/js/src/tests/test262/built-ins/Math/log/length.js new file mode 100644 index 0000000000..e23e758bff --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.20 +description: > + Math.log.length is 1. +info: | + Math.log ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log.length, 1); + +verifyNotEnumerable(Math.log, "length"); +verifyNotWritable(Math.log, "length"); +verifyConfigurable(Math.log, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/name.js b/js/src/tests/test262/built-ins/Math/log/name.js new file mode 100644 index 0000000000..35009aa9d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.20 +description: > + Math.log.name is "log". +info: | + Math.log ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log.name, "log"); + +verifyNotEnumerable(Math.log, "name"); +verifyNotWritable(Math.log, "name"); +verifyConfigurable(Math.log, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/log/not-a-constructor.js new file mode 100644 index 0000000000..2fe1ae7ee6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.log does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.log), false, 'isConstructor(Math.log) must return false'); + +assert.throws(TypeError, () => { + new Math.log(); +}, '`new Math.log()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/prop-desc.js b/js/src/tests/test262/built-ins/Math/log/prop-desc.js new file mode 100644 index 0000000000..d3c6d792a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.log +description: > + "log" property of Math +info: | + Section 17: 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(Math, "log"); +verifyWritable(Math, "log"); +verifyConfigurable(Math, "log"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log/shell.js b/js/src/tests/test262/built-ins/Math/log/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/log10/Log10-specialVals.js b/js/src/tests/test262/built-ins/Math/log10/Log10-specialVals.js new file mode 100644 index 0000000000..55e6ef857d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/Log10-specialVals.js @@ -0,0 +1,34 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.Log10 with sample values. +es6id: 20.2.2.20 +---*/ + +assert.sameValue(Math.log10(-0), Number.NEGATIVE_INFINITY, + "Math.log10 produces incorrect output for -0"); +assert.sameValue(Math.log10(+0), Number.NEGATIVE_INFINITY, + "Math.log10 produces incorrect output for +0"); +assert.sameValue(Math.log10(-0.9), Number.NaN, + "Math.log10 produces incorrect output for -0.9"); +assert.sameValue(Math.log10(NaN), Number.NaN, + "Math.log10 produces incorrect output for NaN"); +assert.sameValue(Math.log10(-10), Number.NaN, + "Math.log10 produces incorrect output for -10"); +assert.sameValue(Math.log10(null), Number.NEGATIVE_INFINITY, + "Math.log10 produces incorrect output for null"); +assert.sameValue(Math.log10(undefined), Number.NaN, + "Math.log10 produces incorrect output for undefined"); +assert.sameValue(Math.log10(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.log10 produces incorrect output for Number.POSITIVE_INFINITY"); +assert.sameValue(Math.log10(1), 0, + "Math.log10 produces incorrect output for 1"); +assert.sameValue(Math.log10(10.00), 1, + "Math.log10 produces incorrect output for 10.00"); +assert.sameValue(Math.log10(100.00), 2, + "Math.log10 produces incorrect output for 100.00"); +assert.sameValue(Math.log10(1000.00), 3, + "Math.log10 produces incorrect output for 1000.00"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log10/browser.js b/js/src/tests/test262/built-ins/Math/log10/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/log10/length.js b/js/src/tests/test262/built-ins/Math/log10/length.js new file mode 100644 index 0000000000..679d3f0b62 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.20 +description: length property of Math.log10 +info: | + Math.log10 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log10.length, 1); + +verifyNotEnumerable(Math.log10, "length"); +verifyNotWritable(Math.log10, "length"); +verifyConfigurable(Math.log10, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log10/name.js b/js/src/tests/test262/built-ins/Math/log10/name.js new file mode 100644 index 0000000000..a41195533b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.22 +description: > + Math.log10.name is "log10". +info: | + Math.log10 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log10.name, "log10"); + +verifyNotEnumerable(Math.log10, "name"); +verifyNotWritable(Math.log10, "name"); +verifyConfigurable(Math.log10, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log10/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/log10/not-a-constructor.js new file mode 100644 index 0000000000..aacc516ebf --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.log10 does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.log10), false, 'isConstructor(Math.log10) must return false'); + +assert.throws(TypeError, () => { + new Math.log10(); +}, '`new Math.log10()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log10/prop-desc.js b/js/src/tests/test262/built-ins/Math/log10/prop-desc.js new file mode 100644 index 0000000000..fe5e11fc79 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/prop-desc.js @@ -0,0 +1,15 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: > + "log10" property of Math +includes: [propertyHelper.js] +es6id: 20.2.2.20 +---*/ + +verifyNotEnumerable(Math, "log10"); +verifyWritable(Math, "log10"); +verifyConfigurable(Math, "log10"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log10/shell.js b/js/src/tests/test262/built-ins/Math/log10/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log10/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/log1p/browser.js b/js/src/tests/test262/built-ins/Math/log1p/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/log1p/length.js b/js/src/tests/test262/built-ins/Math/log1p/length.js new file mode 100644 index 0000000000..40327f636c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.21 +description: length property of Math.log1p +info: | + Math.log1p ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log1p.length, 1); + +verifyNotEnumerable(Math.log1p, "length"); +verifyNotWritable(Math.log1p, "length"); +verifyConfigurable(Math.log1p, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log1p/name.js b/js/src/tests/test262/built-ins/Math/log1p/name.js new file mode 100644 index 0000000000..9287af89ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.21 +description: > + Math.log1p.name is "log1p". +info: | + Math.log1p ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log1p.name, "log1p"); + +verifyNotEnumerable(Math.log1p, "name"); +verifyNotWritable(Math.log1p, "name"); +verifyConfigurable(Math.log1p, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log1p/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/log1p/not-a-constructor.js new file mode 100644 index 0000000000..f89122aac0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.log1p does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.log1p), false, 'isConstructor(Math.log1p) must return false'); + +assert.throws(TypeError, () => { + new Math.log1p(); +}, '`new Math.log1p()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log1p/prop-desc.js b/js/src/tests/test262/built-ins/Math/log1p/prop-desc.js new file mode 100644 index 0000000000..8d16e87bc9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.log1p +includes: [propertyHelper.js] +es6id: 20.2.2.21 +---*/ + +verifyNotEnumerable(Math, "log1p"); +verifyWritable(Math, "log1p"); +verifyConfigurable(Math, "log1p"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log1p/shell.js b/js/src/tests/test262/built-ins/Math/log1p/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/log1p/specific-results.js b/js/src/tests/test262/built-ins/Math/log1p/specific-results.js new file mode 100644 index 0000000000..38452abf77 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log1p/specific-results.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.log1p +description: > + Return specific results +info: | + Math.log1p ( x ) + + If x is NaN, the result is NaN. + If x is less than -1, the result is NaN. + If x is -1, the result is -∞. + If x is +0, the result is +0. + If x is -0, the result is -0. + If x is +∞, the result is +∞. +---*/ + +assert.sameValue(Math.log1p(NaN), NaN, "NaN"); +assert.sameValue(Math.log1p(-1.000001), NaN, "-1.000001"); +assert.sameValue(Math.log1p(-2), NaN, "-2"); +assert.sameValue(Math.log1p(-Infinity), NaN, "-Infinity"); +assert.sameValue(Math.log1p(-1), -Infinity, "-1"); +assert.sameValue(Math.log1p(0), 0, "0"); +assert.sameValue(Math.log1p(-0), -0, "-0"); +assert.sameValue(Math.log1p(Infinity), Infinity, "Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/browser.js b/js/src/tests/test262/built-ins/Math/log2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/log2/length.js b/js/src/tests/test262/built-ins/Math/log2/length.js new file mode 100644 index 0000000000..4763011f45 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/length.js @@ -0,0 +1,30 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es6id: 20.2.2.23 +description: length property of Math.log2 +info: | + Math.log2 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log2.length, 1); + +verifyNotEnumerable(Math.log2, "length"); +verifyNotWritable(Math.log2, "length"); +verifyConfigurable(Math.log2, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/log2-basicTests.js b/js/src/tests/test262/built-ins/Math/log2/log2-basicTests.js new file mode 100644 index 0000000000..3e0a33e014 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/log2-basicTests.js @@ -0,0 +1,36 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.Log2 with sample values. +es6id: 20.2.2.23 +---*/ + +assert.sameValue(Math.log2(-0), Number.NEGATIVE_INFINITY, + "Math.log2 produces incorrect output for -0"); +assert.sameValue(Math.log2(+0), Number.NEGATIVE_INFINITY, + "Math.log2 produces incorrect output for +0"); +assert.sameValue(Math.log2(-0.9), NaN, + "Math.log2 produces incorrect output for -0.9"); +assert.sameValue(Math.log2(NaN), NaN, + "Math.log2 produces incorrect output for NaN"); +assert.sameValue(Math.log2(-10), NaN, + "Math.log2 produces incorrect output for -10"); +assert.sameValue(Math.log2(-Infinity), NaN, + "Math.log2 produces incorrect output for -Infinity"); +assert.sameValue(Math.log2(null), Number.NEGATIVE_INFINITY, + "Math.log2 produces incorrect output for null"); +assert.sameValue(Math.log2(undefined), NaN, + "Math.log2 produces incorrect output for undefined"); +assert.sameValue(Math.log2(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.log2 produces incorrect output for Number.POSITIVE_INFINITY"); +assert.sameValue(Math.log2(1), 0, + "Math.log2 produces incorrect output for 1"); +assert.sameValue(Math.log2(2.00), 1, + "Math.log2 produces incorrect output for 2.00"); +assert.sameValue(Math.log2(4.00), 2, + "Math.log2 produces incorrect output for 4.00"); +assert.sameValue(Math.log2(8.00), 3, + "Math.log2 produces incorrect output for 8.00"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/name.js b/js/src/tests/test262/built-ins/Math/log2/name.js new file mode 100644 index 0000000000..33af36ac29 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.23 +description: > + Math.log2.name is "log2". +info: | + Math.log2 ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.log2.name, "log2"); + +verifyNotEnumerable(Math.log2, "name"); +verifyNotWritable(Math.log2, "name"); +verifyConfigurable(Math.log2, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/log2/not-a-constructor.js new file mode 100644 index 0000000000..1a40c155c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.log2 does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.log2), false, 'isConstructor(Math.log2) must return false'); + +assert.throws(TypeError, () => { + new Math.log2(); +}, '`new Math.log2()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/prop-desc.js b/js/src/tests/test262/built-ins/Math/log2/prop-desc.js new file mode 100644 index 0000000000..15ab8c6890 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.log2 +includes: [propertyHelper.js] +es6id: 20.2.2.23 +---*/ + +verifyNotEnumerable(Math, "log2"); +verifyWritable(Math, "log2"); +verifyConfigurable(Math, "log2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/log2/shell.js b/js/src/tests/test262/built-ins/Math/log2/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/log2/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/max/15.8.2.11-1.js b/js/src/tests/test262/built-ins/Math/max/15.8.2.11-1.js new file mode 100644 index 0000000000..a504429170 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/15.8.2.11-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.8.2.11-1 +description: Math.max({}) is NaN +---*/ + +assert.sameValue(Math.max({}), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/Math.max_each-element-coerced.js b/js/src/tests/test262/built-ins/Math/max/Math.max_each-element-coerced.js new file mode 100644 index 0000000000..98488f710e --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/Math.max_each-element-coerced.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Vladislav Lazurenko. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.max +description: Call ToNumber on each element of params +info: | + 2. For each element arg of args, do + Let n be ? ToNumber(arg). + Append n to coerced. +---*/ + +let valueOf_calls = 0; + +const n = { + valueOf: function() { + valueOf_calls++; + } +}; +Math.max(NaN, n); +assert.sameValue(valueOf_calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A1.js b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A1.js new file mode 100644 index 0000000000..d54b44c01a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A1.js @@ -0,0 +1,11 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If no arguments are given, Math.max() is -Infinity +es5id: 15.8.2.11_A1 +description: Checking if Math.max() equals to -Infinity +---*/ +assert.sameValue(Math.max(), -Infinity, 'Math.max() must return -Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A2.js b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A2.js new file mode 100644 index 0000000000..bf2fe00a0a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A2.js @@ -0,0 +1,68 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If any value is NaN, the result of Math.max is NaN +es5id: 15.8.2.11_A2 +description: > + The script tests Math.max giving 1, 2 and 3 arguments to the + function where at least one of the arguments is NaN +---*/ + +assert.sameValue(Math.max(NaN), NaN, "NaN"); + +// CHECK#2 +var vals = new Array(); +vals[0] = -Infinity; +vals[1] = -0.000000000000001; +vals[2] = -0; +vals[3] = +0 +vals[4] = 0.000000000000001; +vals[5] = +Infinity; +vals[6] = NaN; +var valnum = 7; + +var args = new Array(); +for (var i = 0; i <= 1; i++) +{ + args[i] = NaN; + for (var j = 0; j < valnum; j++) + { + args[1 - i] = vals[j]; + assert.sameValue( + Math.max(args[0], args[1]), + NaN, + "max(" + args[0] + ", " + args[1] + ")" + ); + } +} + +// CHECK #3 +var k = 1; +var l = 2; +for (var i = 0; i <= 2; i++) +{ + args[i] = NaN; + if (i === 1) + { + k = 0; + } else if (i === 2) + { + l = 1; + } + for (var j = 0; j < valnum; j++) + { + for (var jj = 0; jj < valnum; jj++) + { + args[k] = vals[j]; + args[l] = vals[jj]; + assert.sameValue( + Math.max(args[0], args[1], args[2]), + NaN, + "max(" + args[0] + ", " + args[1] + ", " + args[2] + ")" + ); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A4.js b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A4.js new file mode 100644 index 0000000000..ba2ab9cf00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/S15.8.2.11_A4.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of the Math.max method is 2 +es5id: 15.8.2.11_A4 +description: Checking if Math.max.length property is defined and equals to 2 +---*/ +assert.sameValue(typeof Math.max, "function", 'The value of `typeof Math.max` is expected to be "function"'); +assert.notSameValue(typeof Math.max.length, "undefined", 'The value of typeof Math.max.length is not "undefined"'); +assert.sameValue(Math.max.length, 2, 'The value of Math.max.length is expected to be 2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/browser.js b/js/src/tests/test262/built-ins/Math/max/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/max/length.js b/js/src/tests/test262/built-ins/Math/max/length.js new file mode 100644 index 0000000000..a985231596 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.max +description: > + "length" property of Math.max +info: | + Math.max ( value1, value2, ...values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.max.length, 2); + +verifyNotEnumerable(Math.max, "length"); +verifyNotWritable(Math.max, "length"); +verifyConfigurable(Math.max, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/name.js b/js/src/tests/test262/built-ins/Math/max/name.js new file mode 100644 index 0000000000..2078d602bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.24 +description: > + Math.max.name is "max". +info: | + Math.max ( value1, value2 , …values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.max.name, "max"); + +verifyNotEnumerable(Math.max, "name"); +verifyNotWritable(Math.max, "name"); +verifyConfigurable(Math.max, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/max/not-a-constructor.js new file mode 100644 index 0000000000..36e92c627c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.max does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.max), false, 'isConstructor(Math.max) must return false'); + +assert.throws(TypeError, () => { + new Math.max(); +}, '`new Math.max()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/prop-desc.js b/js/src/tests/test262/built-ins/Math/max/prop-desc.js new file mode 100644 index 0000000000..6b8fbac518 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.max +description: > + "max" property of Math +info: | + Section 17: 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(Math, "max"); +verifyWritable(Math, "max"); +verifyConfigurable(Math, "max"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/max/shell.js b/js/src/tests/test262/built-ins/Math/max/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/max/zeros.js b/js/src/tests/test262/built-ins/Math/max/zeros.js new file mode 100644 index 0000000000..42892ae481 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/max/zeros.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.max +description: > + +0 is considered to be larger than -0 +info: | + Math.max ( value1, value2 , …values ) + + The comparison of values to determine the largest value is done using the + Abstract Relational Comparison algorithm except that +0 is considered to be + larger than -0. +---*/ + +assert.sameValue(Math.max(0, 0), 0, "(0, 0)"); +assert.sameValue(Math.max(-0, -0), -0, "(-0, -0)"); +assert.sameValue(Math.max(0, -0), 0, "(0, -0)"); +assert.sameValue(Math.max(-0, 0), 0, "(-0, 0)"); +assert.sameValue(Math.max(0, 0, -0), 0, "(0, 0, -0)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/15.8.2.12-1.js b/js/src/tests/test262/built-ins/Math/min/15.8.2.12-1.js new file mode 100644 index 0000000000..7f7c789cd7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/15.8.2.12-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.8.2.12-1 +description: Math.min({}) is NaN +---*/ + +assert.sameValue(Math.min({}), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/Math.min_each-element-coerced.js b/js/src/tests/test262/built-ins/Math/min/Math.min_each-element-coerced.js new file mode 100644 index 0000000000..2183e1847b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/Math.min_each-element-coerced.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Vladislav Lazurenko. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.min +description: Call ToNumber on each element of params +info: | + 2. For each element arg of args, do + Let n be ? ToNumber(arg). + Append n to coerced. +---*/ + +let valueOf_calls = 0; + +const n = { + valueOf: function() { + valueOf_calls++; + } +}; +Math.min(NaN, n); +assert.sameValue(valueOf_calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A1.js b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A1.js new file mode 100644 index 0000000000..6f8b422680 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A1.js @@ -0,0 +1,11 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If no arguments are given, Math.min() is +Infinity +es5id: 15.8.2.12_A1 +description: Checking if Math.min() equals to +Infinity +---*/ +assert.sameValue(Math.min(), +Infinity, 'Math.min() must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A2.js b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A2.js new file mode 100644 index 0000000000..8fa7d672ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A2.js @@ -0,0 +1,69 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If any value is NaN, the result of Math.min is NaN +es5id: 15.8.2.12_A2 +description: > + The script tests Math.min giving 1, 2 and 3 arguments to the + function where at least one of the arguments is NaN +---*/ + +// CHECK#1 +assert.sameValue(Math.min(NaN), NaN, "NaN"); + +// CHECK#2 +var vals = new Array(); +vals[0] = -Infinity; +vals[1] = -0.000000000000001; +vals[2] = -0; +vals[3] = +0 +vals[4] = 0.000000000000001; +vals[5] = +Infinity; +vals[6] = NaN; +var valnum = 7; + +var args = new Array(); +for (var i = 0; i <= 1; i++) +{ + args[i] = NaN; + for (var j = 0; j < valnum; j++) + { + args[1 - i] = vals[j]; + assert.sameValue( + Math.min(args[0], args[1]), + NaN, + "min(" + args[0] + ", " + args[1] + ")" + ); + } +} + +// CHECK #3 +var k = 1; +var l = 2; +for (var i = 0; i <= 2; i++) +{ + args[i] = NaN; + if (i === 1) + { + k = 0; + } else if (i === 2) + { + l = 1; + } + for (var j = 0; j < valnum; j++) + { + for (var jj = 0; jj < valnum; jj++) + { + args[k] = vals[j]; + args[l] = vals[jj]; + assert.sameValue( + Math.min(args[0], args[1], args[2]), + NaN, + "min(" + args[0] + ", " + args[1] + ", " + args[2] + ")" + ); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A4.js b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A4.js new file mode 100644 index 0000000000..6af0a31714 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/S15.8.2.12_A4.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of the Math.min method is 2 +es5id: 15.8.2.12_A4 +description: Checking if Math.min.length property is defined and equals to 2 +---*/ +assert.sameValue(typeof Math.min, "function", 'The value of `typeof Math.min` is expected to be "function"'); +assert.notSameValue(typeof Math.min.length, "undefined", 'The value of typeof Math.min.length is not "undefined"'); +assert.sameValue(Math.min.length, 2, 'The value of Math.min.length is expected to be 2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/browser.js b/js/src/tests/test262/built-ins/Math/min/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/min/length.js b/js/src/tests/test262/built-ins/Math/min/length.js new file mode 100644 index 0000000000..65706dd110 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.min +description: > + "length" property of Math.min +info: | + Math.min ( value1, value2, ...values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.min.length, 2); + +verifyNotEnumerable(Math.min, "length"); +verifyNotWritable(Math.min, "length"); +verifyConfigurable(Math.min, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/name.js b/js/src/tests/test262/built-ins/Math/min/name.js new file mode 100644 index 0000000000..2fc9c3d206 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.25 +description: > + Math.min.name is "min". +info: | + Math.min ( value1, value2 , …values ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.min.name, "min"); + +verifyNotEnumerable(Math.min, "name"); +verifyNotWritable(Math.min, "name"); +verifyConfigurable(Math.min, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/min/not-a-constructor.js new file mode 100644 index 0000000000..24fca032af --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.min does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.min), false, 'isConstructor(Math.min) must return false'); + +assert.throws(TypeError, () => { + new Math.min(); +}, '`new Math.min()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/prop-desc.js b/js/src/tests/test262/built-ins/Math/min/prop-desc.js new file mode 100644 index 0000000000..01e8c74075 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.min +description: > + "min" property of Math +info: | + Section 17: 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(Math, "min"); +verifyWritable(Math, "min"); +verifyConfigurable(Math, "min"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/min/shell.js b/js/src/tests/test262/built-ins/Math/min/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/min/zeros.js b/js/src/tests/test262/built-ins/Math/min/zeros.js new file mode 100644 index 0000000000..1f3700b993 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/min/zeros.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.min +description: > + +0 is considered to be larger than -0 +info: | + Math.min ( value1, value2 , …values ) + + The comparison of values to determine the smallest value is done using the + Abstract Relational Comparison algorithm except that +0 is considered to be + larger than -0. +---*/ + +assert.sameValue(Math.min(0, 0), 0, "(0, 0)"); +assert.sameValue(Math.min(-0, -0), -0, "(-0, -0)"); +assert.sameValue(Math.min(0, -0), -0, "(0, -0)"); +assert.sameValue(Math.min(-0, 0), -0, "(-0, 0)"); +assert.sameValue(Math.min(0, 0, -0), -0, "(0, 0, -0)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js new file mode 100644 index 0000000000..2aa4d453fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If exponent is NaN, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = NaN; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + base[i] + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js new file mode 100644 index 0000000000..b074244a36 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A10.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) < 1 and exponent is −∞, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = 0.999999999999999; +base[1] = 0.5; +base[2] = +0; +base[3] = -0; +base[4] = -0.5; +base[5] = -0.999999999999999; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js new file mode 100644 index 0000000000..c5a06914f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A11.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +∞ and exponent > 0, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +Infinity; +var exponent = new Array(); +exponent[3] = Infinity; +exponent[2] = 1.7976931348623157E308; //largest (by module) finite number +exponent[1] = 1; +exponent[0] = 0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js new file mode 100644 index 0000000000..d8ff1d28a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A12.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +∞ and exponent < 0, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +Infinity; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -1; +exponent[3] = -0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.js new file mode 100644 index 0000000000..648e70f315 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A13.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. + +/*--- +description: If base is −∞ and exponent > 0 and exponent is an odd integer, the result is −∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[0] = 1; +exponent[1] = 111; +exponent[2] = 111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== -Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js new file mode 100644 index 0000000000..240dc2d5c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A14.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is −∞ and exponent > 0 and exponent is not an odd integer, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[0] = 0.000000000000001; +exponent[1] = 2; +exponent[2] = Math.PI; +exponent[3] = 1.7976931348623157E308; //largest finite number +exponent[4] = +Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.js new file mode 100644 index 0000000000..6847e897d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A15.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. + +/*--- +description: If base is −∞ and exponent < 0 and exponent is an odd integer, the result is −0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[2] = -1; +exponent[1] = -111; +exponent[0] = -111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.js new file mode 100644 index 0000000000..a12153e1c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A16.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. + +/*--- +description: If base is −∞ and exponent < 0 and exponent is not an odd integer, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -Infinity; +var exponent = new Array(); +exponent[4] = -0.000000000000001; +exponent[3] = -2; +exponent[2] = -Math.PI; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[0] = -Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js new file mode 100644 index 0000000000..cbf1926898 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A17.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +0 and exponent > 0, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +0; +var exponent = new Array(); +exponent[3] = Infinity; +exponent[2] = 1.7976931348623157E308; //largest finite number +exponent[1] = 1; +exponent[0] = 0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js new file mode 100644 index 0000000000..49dc14fe83 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A18.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is +0 and exponent < 0, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = +0; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -1; +exponent[3] = -0.000000000000001; +var exponentnum = 4; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.js new file mode 100644 index 0000000000..0fe1c46bc2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A19.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. + +/*--- +description: If base is −0 and exponent > 0 and exponent is an odd integer, the result is −0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[0] = 1; +exponent[1] = 111; +exponent[2] = 111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), -0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js new file mode 100644 index 0000000000..99bac1d4e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If exponent is +0, the result is 1, even if base is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +0; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== 1) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.js new file mode 100644 index 0000000000..dc51e7312b --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A20.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. + +/*--- +description: If base is −0 and exponent > 0 and exponent is not an odd integer, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[0] = 0.000000000000001; +exponent[1] = 2; +exponent[2] = Math.PI; +exponent[3] = 1.7976931348623157E308; //largest finite number +exponent[4] = +Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue(Math.pow(base, exponent[i]), 0, exponent[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.js new file mode 100644 index 0000000000..de7557f51d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A21.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. + +/*--- +description: If base is −0 and exponent < 0 and exponent is an odd integer, the result is −∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[2] = -1; +exponent[1] = -111; +exponent[0] = -111111; +var exponentnum = 3; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== -Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js new file mode 100644 index 0000000000..021a756690 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A22.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is −0 and exponent < 0 and exponent is not an odd integer, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var base = -0; +var exponent = new Array(); +exponent[4] = -0.000000000000001; +exponent[3] = -2; +exponent[2] = -Math.PI; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[0] = -Infinity; +var exponentnum = 5; + +for (var i = 0; i < exponentnum; i++) { + if (Math.pow(base, exponent[i]) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base + ", " + exponent[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js new file mode 100644 index 0000000000..6f389c524a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A23.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = new Array(); +var base = new Array(); +base[0] = -1.7976931348623157E308; //largest (by module) finite number +base[1] = -Math.PI; +base[2] = -1; +base[3] = -0.000000000000001; +var basenum = 4; + +exponent[0] = -Math.PI; +exponent[1] = -Math.E; +exponent[2] = -1.000000000000001; +exponent[3] = -0.000000000000001; +exponent[4] = 0.000000000000001; +exponent[5] = 1.000000000000001; +exponent[6] = Math.E; +exponent[7] = Math.PI; + +var exponentnum = 8; + +for (var i = 0; i < basenum; i++) { + for (var j = 0; j < exponentnum; j++) { + assert.sameValue( + Math.pow(base[i], exponent[j]), + NaN, + "(" + base[i] + ", " + exponent[j] + ")" + ); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js new file mode 100644 index 0000000000..c61fed40d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If exponent is −0, the result is 1, even if base is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -0; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -0.000000000000001; +base[3] = -0; +base[4] = +0 +base[5] = 0.000000000000001; +base[6] = 1.7976931348623157E308; //largest finite number +base[7] = +Infinity; +base[8] = NaN; +var basenum = 9; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== 1) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", -0) !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js new file mode 100644 index 0000000000..d1426b6e50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If base is NaN and exponent is nonzero, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var base = NaN; +var exponent = new Array(); +exponent[0] = -Infinity; +exponent[1] = -1.7976931348623157E308; //largest (by module) finite number +exponent[2] = -0.000000000000001; +exponent[3] = 0.000000000000001; +exponent[4] = 1.7976931348623157E308; //largest finite number +exponent[5] = +Infinity; +exponent[6] = NaN; +var exponentnum = 7; + +for (var i = 0; i < exponentnum; i++) { + assert.sameValue( + Math.pow(base, exponent[i]), + NaN, + "(" + base + ", " + exponent[i] + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js new file mode 100644 index 0000000000..a827298cac --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A5.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) > 1 and exponent is +∞, the result is +∞. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -1.000000000000001; +base[3] = 1.000000000000001; +base[4] = 1.7976931348623157E308; //largest finite number +base[5] = +Infinity; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + if (Math.pow(base[i], exponent) !== +Infinity) { + throw new Test262Error("#1: Math.pow(" + base[i] + ", " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js new file mode 100644 index 0000000000..419d321dc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A6.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) > 1 and exponent is −∞, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = -Infinity; +base[1] = -1.7976931348623157E308; //largest (by module) finite number +base[2] = -1.000000000000001; +base[3] = 1.000000000000001; +base[4] = 1.7976931348623157E308; //largest finite number +base[5] = +Infinity; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + assert.sameValue(Math.pow(base[i], exponent), 0, base[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js new file mode 100644 index 0000000000..c741bdbe60 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A7.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) is 1 and exponent is +∞, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = -1; +base[1] = 1 +var basenum = 2; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js new file mode 100644 index 0000000000..64c11f9dfa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A8.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) is 1 and exponent is −∞, the result is NaN. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = -Infinity; +var base = new Array(); +base[0] = -1; +base[1] = 1 +var basenum = 2; + +for (var i = 0; i < basenum; i++) { + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js new file mode 100644 index 0000000000..d46eaa49fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/applying-the-exp-operator_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: If abs(base) < 1 and exponent is +∞, the result is +0. +esid: sec-applying-the-exp-operator +---*/ + + +var exponent = +Infinity; +var base = new Array(); +base[0] = 0.999999999999999; +base[1] = 0.5; +base[2] = +0; +base[3] = -0; +base[4] = -0.5; +base[5] = -0.999999999999999; +var basenum = 6; + +for (var i = 0; i < basenum; i++) { + assert.sameValue(Math.pow(base[i], exponent), 0, exponent); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/browser.js b/js/src/tests/test262/built-ins/Math/pow/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js b/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js new file mode 100644 index 0000000000..bf71518987 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/int32_min-exponent.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + Using -(2**31) as exponent with Math.pow should behave as expected. +---*/ + +const INT32_MIN = -2147483648; + +assert.sameValue(Math.pow(2, INT32_MIN), +0.0, + "Math.pow(2, -(gonzo huge exponent > 1074)) should be +0 " + + "because 2**-1074 is the smallest positive IEEE-754 number"); + +assert.sameValue(Math.pow(1, INT32_MIN), 1, + "1**-(gonzo huge exponent > 1074) should be 1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/length.js b/js/src/tests/test262/built-ins/Math/pow/length.js new file mode 100644 index 0000000000..0ac918c8fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.pow +description: > + Math.pow.length is 2. +info: | + Math.pow ( x, y ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form "...name" + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.pow.length, 2); + +verifyNotEnumerable(Math.pow, "length"); +verifyNotWritable(Math.pow, "length"); +verifyConfigurable(Math.pow, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/name.js b/js/src/tests/test262/built-ins/Math/pow/name.js new file mode 100644 index 0000000000..c0caa2c9ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.pow +description: > + Math.pow.name is "pow". +info: | + Math.pow ( x, y ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.pow.name, "pow"); + +verifyNotEnumerable(Math.pow, "name"); +verifyNotWritable(Math.pow, "name"); +verifyConfigurable(Math.pow, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js new file mode 100644 index 0000000000..00ba4261fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.pow does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.pow), false, 'isConstructor(Math.pow) must return false'); + +assert.throws(TypeError, () => { + new Math.pow(); +}, '`new Math.pow()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/prop-desc.js b/js/src/tests/test262/built-ins/Math/pow/prop-desc.js new file mode 100644 index 0000000000..9ab2090f52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.pow +description: > + Math.pow ( base, exponent ) +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(Math, "pow"); +verifyWritable(Math, "pow"); +verifyConfigurable(Math, "pow"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/pow/shell.js b/js/src/tests/test262/built-ins/Math/pow/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/pow/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/prop-desc.js b/js/src/tests/test262/built-ins/Math/prop-desc.js new file mode 100644 index 0000000000..898c59a4a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/prop-desc.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math-object +description: > + Property descriptor of Math +info: | + The Math Object + + ... + The Math object does not have a [[Construct]] internal method; + it is not possible to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] internal method; + it is not possible to invoke the Math object as a function. + + 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] +---*/ + +assert.sameValue(typeof Math, "object"); + +assert.throws(TypeError, function() { + Math(); +}, "no [[Call]]"); + +assert.throws(TypeError, function() { + new Math(); +}, "no [[Construct]]"); + +verifyProperty(this, "Math", { + enumerable: false, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/proto.js b/js/src/tests/test262/built-ins/Math/proto.js new file mode 100644 index 0000000000..4669750fbb --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/proto.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math-object +description: > + The prototype of Math is Object.prototype +info: | + The Math Object + + The value of the [[Prototype]] internal slot of the Math object is the + intrinsic object %ObjectPrototype%. +---*/ + +var proto = Object.getPrototypeOf(Math); + +assert.sameValue(proto, Object.prototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/S15.8.2.14_A1.js b/js/src/tests/test262/built-ins/Math/random/S15.8.2.14_A1.js new file mode 100644 index 0000000000..d660d3e68d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/S15.8.2.14_A1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Math.random() returns a number value with positive sign, greater than or + equal to 0 but less than 1 +es5id: 15.8.2.14_A1 +description: > + Checking if Math.random() is a number between 0 and 1, calling + Math.random() 100 times +---*/ + +// CHECK#1 +for (var i = 0; i < 100; i++) +{ + var val = Math.random(); + + assert.sameValue( + typeof val, 'number', 'should not produce a non-numeric value: ' + val + ); + assert.notSameValue(val, NaN, 'should not produce NaN'); + + if (val < 0 || val >= 1) + { + throw new Test262Error("#1: Math.random() = " + val); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/browser.js b/js/src/tests/test262/built-ins/Math/random/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/random/length.js b/js/src/tests/test262/built-ins/Math/random/length.js new file mode 100644 index 0000000000..21c8e5304f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.27 +description: > + Math.random.length is 0. +info: | + Math.random ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.random.length, 0); + +verifyNotEnumerable(Math.random, "length"); +verifyNotWritable(Math.random, "length"); +verifyConfigurable(Math.random, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/name.js b/js/src/tests/test262/built-ins/Math/random/name.js new file mode 100644 index 0000000000..a6f983e5bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.27 +description: > + Math.random.name is "random". +info: | + Math.random ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.random.name, "random"); + +verifyNotEnumerable(Math.random, "name"); +verifyNotWritable(Math.random, "name"); +verifyConfigurable(Math.random, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/random/not-a-constructor.js new file mode 100644 index 0000000000..8160a93744 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.random does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.random), false, 'isConstructor(Math.random) must return false'); + +assert.throws(TypeError, () => { + new Math.random(); +}, '`new Math.random()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/prop-desc.js b/js/src/tests/test262/built-ins/Math/random/prop-desc.js new file mode 100644 index 0000000000..c78765c574 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.random +description: > + "random" property of Math +info: | + Section 17: 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(Math, "random"); +verifyWritable(Math, "random"); +verifyConfigurable(Math, "random"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/random/shell.js b/js/src/tests/test262/built-ins/Math/random/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/random/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A1.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A1.js new file mode 100644 index 0000000000..8bed2740d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.round(x) is NaN +es5id: 15.8.2.15_A1 +description: Checking if Math.round(x) is NaN, where x is NaN +---*/ + +assert.sameValue(Math.round(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A2.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A2.js new file mode 100644 index 0000000000..5248d4434c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.round(x) is +0 +es5id: 15.8.2.15_A2 +description: Checking if Math.round(x) equals to +0, where x is +0 +---*/ + +assert.sameValue(Math.round(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A3.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A3.js new file mode 100644 index 0000000000..7df73fb8fd --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.round(x) is -0 +es5id: 15.8.2.15_A3 +description: Checking if Math.round(x) equals to -0, where x is -0 +---*/ + +assert.sameValue(Math.round(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A4.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A4.js new file mode 100644 index 0000000000..498914393f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A4.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. + +/*--- +info: If x is +Infinity, Math.round(x) is +Infinity +es5id: 15.8.2.15_A4 +description: Checking if Math.round(x) is +Infinity, where x is +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.round(x), +Infinity, 'Math.round(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A5.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A5.js new file mode 100644 index 0000000000..684ae3d86d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A5.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. + +/*--- +info: If x is -Infinity, Math.round(x) is -Infinity +es5id: 15.8.2.15_A5 +description: Checking if Math.round(x) is -Infinity, where x is -Infinity +---*/ + +// CHECK#1 +var x = -Infinity; +assert.sameValue(Math.round(x), -Infinity, 'Math.round(-Infinity) must return -Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A6.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A6.js new file mode 100644 index 0000000000..0c41087f28 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A6.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If x is equal to 0 or greater than 0, or if x is less than -0.5, + Math.round(x) is equal to Math.floor(x+0.5) +es5id: 15.8.2.15_A6 +description: > + Checking if Math.round(x) is equal to Math.floor(x+0.5), where x + equals to 0, greater than 0, or is less than -0.5; this check is + performed on 2000 argument x values +---*/ + +// CHECK#1 +for (var i = 0; i <= 1000; i++) +{ + var x = i / 10.0; + + assert.sameValue( + Math.round(x), + Math.floor(x + 0.5), + 'Math.round(i / 10.0) must return the same value returned by Math.floor(x + 0.5)' + ); +} + +for (i = -5; i >= -1000; i--) +{ + if (i === -5) + { + x = -0.500000000000001; + } else + { + x = i / 10.0; + } + + assert.sameValue( + Math.round(x), + Math.floor(x + 0.5), + 'Math.round(i / 10.0) must return the same value returned by Math.floor(x + 0.5)' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A7.js b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A7.js new file mode 100644 index 0000000000..d7a3e6e63f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/S15.8.2.15_A7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If x is less than or equal to -0 and x is greater than or equal to -0.5, + Math.round(x) is equal to -0 +es5id: 15.8.2.15_A7 +description: > + `Math.round(x)` differs from `Math.floor(x + 0.5)`: + + 1) for values in [-0.5; -0] + 2) for 0.5 - Number.EPSILON / 4 + 3) for odd integers in [-(2 / Number.EPSILON - 1); -(1 / Number.EPSILON + 1)] or in [1 / Number.EPSILON + 1; 2 / Number.EPSILON - 1] +---*/ +assert.sameValue( + 1 / Math.round(-0.5), + 1 / -0, + 'The result of evaluating (1 / Math.round(-0.5)) is expected to be 1 / -0' +); + +assert.sameValue( + 1 / Math.round(-0.25), + 1 / -0, + 'The result of evaluating (1 / Math.round(-0.25)) is expected to be 1 / -0' +); + +assert.sameValue(1 / Math.round(-0), 1 / -0, 'The result of evaluating (1 / Math.round(-0)) is expected to be 1 / -0'); + +var x = 0; + +// CHECK#4 +x = 0.5 - Number.EPSILON / 4; +assert.sameValue(1 / Math.round(x), 1 / 0, 'The result of evaluating (1 / Math.round(x)) is expected to be 1 / 0'); + +// CHECK#5 +x = -(2 / Number.EPSILON - 1); +assert.sameValue(Math.round(x), x, 'Math.round(-(2 / Number.EPSILON - 1)) returns x'); + +// CHECK#6 +x = -(1.5 / Number.EPSILON - 1); +assert.sameValue(Math.round(x), x, 'Math.round(-(1.5 / Number.EPSILON - 1)) returns x'); + +// CHECK#7 +x = -(1 / Number.EPSILON + 1); +assert.sameValue(Math.round(x), x, 'Math.round(-(1 / Number.EPSILON + 1)) returns x'); + +// CHECK#8 +x = 1 / Number.EPSILON + 1; +assert.sameValue(Math.round(x), x, 'Math.round(1 / Number.EPSILON + 1) returns x'); + +// CHECK#9 +x = 1.5 / Number.EPSILON - 1; +assert.sameValue(Math.round(x), x, 'Math.round(1.5 / Number.EPSILON - 1) returns x'); + +// CHECK#10 +x = 2 / Number.EPSILON - 1; +assert.sameValue(Math.round(x), x, 'Math.round(2 / Number.EPSILON - 1) returns x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/browser.js b/js/src/tests/test262/built-ins/Math/round/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/round/length.js b/js/src/tests/test262/built-ins/Math/round/length.js new file mode 100644 index 0000000000..262c1ddebf --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.28 +description: > + Math.round.length is 1. +info: | + Math.round ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.round.length, 1); + +verifyNotEnumerable(Math.round, "length"); +verifyNotWritable(Math.round, "length"); +verifyConfigurable(Math.round, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/name.js b/js/src/tests/test262/built-ins/Math/round/name.js new file mode 100644 index 0000000000..d1e21d7be4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.28 +description: > + Math.round.name is "round". +info: | + Math.round ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.round.name, "round"); + +verifyNotEnumerable(Math.round, "name"); +verifyNotWritable(Math.round, "name"); +verifyConfigurable(Math.round, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/round/not-a-constructor.js new file mode 100644 index 0000000000..45996875c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.round does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.round), false, 'isConstructor(Math.round) must return false'); + +assert.throws(TypeError, () => { + new Math.round(); +}, '`new Math.round()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/prop-desc.js b/js/src/tests/test262/built-ins/Math/round/prop-desc.js new file mode 100644 index 0000000000..43072ec8e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.round +description: > + "round" property of Math +info: | + Section 17: 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(Math, "round"); +verifyWritable(Math, "round"); +verifyConfigurable(Math, "round"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/round/shell.js b/js/src/tests/test262/built-ins/Math/round/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/round/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/shell.js b/js/src/tests/test262/built-ins/Math/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/sign/browser.js b/js/src/tests/test262/built-ins/Math/sign/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/sign/length.js b/js/src/tests/test262/built-ins/Math/sign/length.js new file mode 100644 index 0000000000..2d172bfaaa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.sign +es6id: 20.2.2.29 +info: | + Math.sign ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sign.length, 1); + +verifyNotEnumerable(Math.sign, "length"); +verifyNotWritable(Math.sign, "length"); +verifyConfigurable(Math.sign, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sign/name.js b/js/src/tests/test262/built-ins/Math/sign/name.js new file mode 100644 index 0000000000..f706d18562 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.29 +description: > + Math.sign.name is "sign". +info: | + Math.sign ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sign.name, "sign"); + +verifyNotEnumerable(Math.sign, "name"); +verifyNotWritable(Math.sign, "name"); +verifyConfigurable(Math.sign, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js new file mode 100644 index 0000000000..73a8f9f7d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.sign does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.sign), false, 'isConstructor(Math.sign) must return false'); + +assert.throws(TypeError, () => { + new Math.sign(); +}, '`new Math.sign()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sign/prop-desc.js b/js/src/tests/test262/built-ins/Math/sign/prop-desc.js new file mode 100644 index 0000000000..4314141924 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.sign +includes: [propertyHelper.js] +es6id: 20.2.2.29 +---*/ + +verifyNotEnumerable(Math, "sign"); +verifyWritable(Math, "sign"); +verifyConfigurable(Math, "sign"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sign/shell.js b/js/src/tests/test262/built-ins/Math/sign/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js b/js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js new file mode 100644 index 0000000000..aec756e173 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sign/sign-specialVals.js @@ -0,0 +1,22 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: > + Returns the sign of the x, indicating whether x is positive, negative or zero. +es6id: 20.2.2.29 +---*/ + +assert.sameValue(Math.sign(NaN), NaN, "NaN"); +assert.sameValue(Math.sign(-0), -0, "-0"); +assert.sameValue(Math.sign(0), 0, "0"); + +assert.sameValue(Math.sign(-0.000001), -1, "-0.000001"); +assert.sameValue(Math.sign(-1), -1, "-1"); +assert.sameValue(Math.sign(-Infinity), -1, "-Infinity"); + +assert.sameValue(Math.sign(0.000001), 1, "0.000001"); +assert.sameValue(Math.sign(1), 1, "1"); +assert.sameValue(Math.sign(Infinity), 1, "Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A1.js b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A1.js new file mode 100644 index 0000000000..f468c005a1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.sin(x) is NaN +es5id: 15.8.2.16_A1 +description: Checking if Math.sin(NaN) is NaN +---*/ + +assert.sameValue(Math.sin(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A4.js b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A4.js new file mode 100644 index 0000000000..83101169b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity, Math.sin(x) is NaN +es5id: 15.8.2.16_A4 +description: Checking if Math.sin(+Infinity) is NaN +---*/ + +assert.sameValue(Math.sin(Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A5.js b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A5.js new file mode 100644 index 0000000000..f90ffc984d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/S15.8.2.16_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, Math.sin(x) is NaN +es5id: 15.8.2.16_A5 +description: Checking if Math.sin(-Infinity) is NaN +---*/ + +assert.sameValue(Math.sin(-Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/browser.js b/js/src/tests/test262/built-ins/Math/sin/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/sin/length.js b/js/src/tests/test262/built-ins/Math/sin/length.js new file mode 100644 index 0000000000..887df3bb9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.30 +description: > + Math.sin.length is 1. +info: | + Math.sin ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sin.length, 1); + +verifyNotEnumerable(Math.sin, "length"); +verifyNotWritable(Math.sin, "length"); +verifyConfigurable(Math.sin, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/name.js b/js/src/tests/test262/built-ins/Math/sin/name.js new file mode 100644 index 0000000000..af0bb7c8a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.30 +description: > + Math.sin.name is "sin". +info: | + Math.sin ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sin.name, "sin"); + +verifyNotEnumerable(Math.sin, "name"); +verifyNotWritable(Math.sin, "name"); +verifyConfigurable(Math.sin, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/sin/not-a-constructor.js new file mode 100644 index 0000000000..fec296dc85 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.sin does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.sin), false, 'isConstructor(Math.sin) must return false'); + +assert.throws(TypeError, () => { + new Math.sin(); +}, '`new Math.sin()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/prop-desc.js b/js/src/tests/test262/built-ins/Math/sin/prop-desc.js new file mode 100644 index 0000000000..882e1cecf7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.sin +description: > + "sin" property of Math +info: | + Section 17: 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(Math, "sin"); +verifyWritable(Math, "sin"); +verifyConfigurable(Math, "sin"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sin/shell.js b/js/src/tests/test262/built-ins/Math/sin/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/sin/zero.js b/js/src/tests/test262/built-ins/Math/sin/zero.js new file mode 100644 index 0000000000..e46664c047 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sin/zero.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.8.2.16_A3 +description: Return arg if -0 or +0 +---*/ + +assert.sameValue(Math.sin(0), 0, "+0"); +assert.sameValue(Math.sin(-0), -0, "-0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sinh/browser.js b/js/src/tests/test262/built-ins/Math/sinh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/sinh/length.js b/js/src/tests/test262/built-ins/Math/sinh/length.js new file mode 100644 index 0000000000..5071e9cc11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.sinh +es6id: 20.2.2.31 +info: | + Math.sinh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sinh.length, 1); + +verifyNotEnumerable(Math.sinh, "length"); +verifyNotWritable(Math.sinh, "length"); +verifyConfigurable(Math.sinh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sinh/name.js b/js/src/tests/test262/built-ins/Math/sinh/name.js new file mode 100644 index 0000000000..b2bb918e69 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.31 +description: > + Math.sinh.name is "sinh". +info: | + Math.sinh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sinh.name, "sinh"); + +verifyNotEnumerable(Math.sinh, "name"); +verifyNotWritable(Math.sinh, "name"); +verifyConfigurable(Math.sinh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sinh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/sinh/not-a-constructor.js new file mode 100644 index 0000000000..9a5ff08bf7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.sinh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.sinh), false, 'isConstructor(Math.sinh) must return false'); + +assert.throws(TypeError, () => { + new Math.sinh(); +}, '`new Math.sinh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sinh/prop-desc.js b/js/src/tests/test262/built-ins/Math/sinh/prop-desc.js new file mode 100644 index 0000000000..69d79060c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.sinh +includes: [propertyHelper.js] +es6id: 20.2.2.31 +---*/ + +verifyNotEnumerable(Math, "sinh"); +verifyWritable(Math, "sinh"); +verifyConfigurable(Math, "sinh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sinh/shell.js b/js/src/tests/test262/built-ins/Math/sinh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/sinh/sinh-specialVals.js b/js/src/tests/test262/built-ins/Math/sinh/sinh-specialVals.js new file mode 100644 index 0000000000..214c9d06c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sinh/sinh-specialVals.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.sinh with special values +es6id: 20.2.2.31 +---*/ + +assert.sameValue(Math.sinh(NaN), Number.NaN, + "Math.sinh produces incorrect output for NaN"); +assert.sameValue(Math.sinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, + "Math.sinh should produce negative infinity for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.sinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.sinh should produce positive infinity for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.sinh(-0), Number.NEGATIVE_INFINITY, + "Math.sinh should produce -0 for -0"); +assert.sameValue(1 / Math.sinh(0), Number.POSITIVE_INFINITY, + "Math.sinh should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A1.js b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A1.js new file mode 100644 index 0000000000..2d8537568d --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.sqrt(x) is NaN +es5id: 15.8.2.17_A1 +description: Checking if Math.sqrt(NaN) is NaN +---*/ + +assert.sameValue(Math.sqrt(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A2.js b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A2.js new file mode 100644 index 0000000000..4a2e18f643 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A2.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. + +/*--- +info: If x less than 0, Math.sqrt(x) is NaN +es5id: 15.8.2.17_A2 +description: Checking if Math.sqrt(x) is NaN, where x is less than 0 +---*/ + +assert.sameValue(Math.sqrt(-0.000000000000001), NaN, "-0.000000000000001"); +assert.sameValue(Math.sqrt(-1), NaN, "-1"); +assert.sameValue(Math.sqrt(-Infinity), NaN, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A3.js b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A3.js new file mode 100644 index 0000000000..06c0ce2aaa --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is equal to +0, Math.sqrt(x) is +0 +es5id: 15.8.2.17_A3 +description: Checking if Math.sqrt(+0) equals to +0 +---*/ + +assert.sameValue(Math.sqrt(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A4.js b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A4.js new file mode 100644 index 0000000000..826bc09c56 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is equal to -0, Math.sqrt(x) is -0 +es5id: 15.8.2.17_A4 +description: Checking if Math.sqrt(-0) equals to -0 +---*/ + +assert.sameValue(Math.sqrt(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A5.js b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A5.js new file mode 100644 index 0000000000..a276f33e33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/S15.8.2.17_A5.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. + +/*--- +info: If x is equal to +Infinity, Math.sqrt(x) is +Infinity +es5id: 15.8.2.17_A5 +description: Checking if Math.sqrt(+Infinity) is +Infinity +---*/ + +// CHECK#1 +var x = +Infinity; +assert.sameValue(Math.sqrt(x), +Infinity, 'Math.sqrt(+Infinity) must return +Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/browser.js b/js/src/tests/test262/built-ins/Math/sqrt/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/sqrt/length.js b/js/src/tests/test262/built-ins/Math/sqrt/length.js new file mode 100644 index 0000000000..566bbf47b5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.32 +description: > + Math.sqrt.length is 1. +info: | + Math.sqrt ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sqrt.length, 1); + +verifyNotEnumerable(Math.sqrt, "length"); +verifyNotWritable(Math.sqrt, "length"); +verifyConfigurable(Math.sqrt, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/name.js b/js/src/tests/test262/built-ins/Math/sqrt/name.js new file mode 100644 index 0000000000..0cca2fc7af --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.32 +description: > + Math.sqrt.name is "sqrt". +info: | + Math.sqrt ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.sqrt.name, "sqrt"); + +verifyNotEnumerable(Math.sqrt, "name"); +verifyNotWritable(Math.sqrt, "name"); +verifyConfigurable(Math.sqrt, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/sqrt/not-a-constructor.js new file mode 100644 index 0000000000..e40a2f5d55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.sqrt does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.sqrt), false, 'isConstructor(Math.sqrt) must return false'); + +assert.throws(TypeError, () => { + new Math.sqrt(); +}, '`new Math.sqrt()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/prop-desc.js b/js/src/tests/test262/built-ins/Math/sqrt/prop-desc.js new file mode 100644 index 0000000000..c038ecba0a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.sqrt +description: > + "sqrt" property of Math +info: | + Section 17: 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(Math, "sqrt"); +verifyWritable(Math, "sqrt"); +verifyConfigurable(Math, "sqrt"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/sqrt/shell.js b/js/src/tests/test262/built-ins/Math/sqrt/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/sqrt/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A1.js b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A1.js new file mode 100644 index 0000000000..7efa079c17 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, Math.tan(x) is NaN +es5id: 15.8.2.18_A1 +description: Checking if Math.tan(NaN) is NaN +---*/ + +assert.sameValue(Math.tan(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A2.js b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A2.js new file mode 100644 index 0000000000..6c43587d3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0, Math.tan(x) is +0 +es5id: 15.8.2.18_A2 +description: Checking if Math.tan(+0) equals to +0 +---*/ + +assert.sameValue(Math.tan(0), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A3.js b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A3.js new file mode 100644 index 0000000000..6270817147 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -0, Math.tan(x) is -0 +es5id: 15.8.2.18_A3 +description: Checking if Math.tan(-0) equals to -0 +---*/ + +assert.sameValue(Math.tan(-0), -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A4.js b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A4.js new file mode 100644 index 0000000000..b9e16e1fe7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A4.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity, Math.tan(x) is NaN +es5id: 15.8.2.18_A4 +description: Checking if Math.tan(+Infinity) is NaN +---*/ + +assert.sameValue(Math.tan(Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A5.js b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A5.js new file mode 100644 index 0000000000..6aa4a76196 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/S15.8.2.18_A5.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, Math.tan(x) is NaN +es5id: 15.8.2.18_A5 +description: Checking if Math.tan(-Infinity) is NaN +---*/ + +assert.sameValue(Math.tan(-Infinity), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/browser.js b/js/src/tests/test262/built-ins/Math/tan/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/tan/length.js b/js/src/tests/test262/built-ins/Math/tan/length.js new file mode 100644 index 0000000000..0915527693 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.33 +description: > + Math.tan.length is 1. +info: | + Math.tan ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.tan.length, 1); + +verifyNotEnumerable(Math.tan, "length"); +verifyNotWritable(Math.tan, "length"); +verifyConfigurable(Math.tan, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/name.js b/js/src/tests/test262/built-ins/Math/tan/name.js new file mode 100644 index 0000000000..e1f3e188d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.33 +description: > + Math.tan.name is "tan". +info: | + Math.tan ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.tan.name, "tan"); + +verifyNotEnumerable(Math.tan, "name"); +verifyNotWritable(Math.tan, "name"); +verifyConfigurable(Math.tan, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/tan/not-a-constructor.js new file mode 100644 index 0000000000..ea79382a35 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.tan does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.tan), false, 'isConstructor(Math.tan) must return false'); + +assert.throws(TypeError, () => { + new Math.tan(); +}, '`new Math.tan()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/prop-desc.js b/js/src/tests/test262/built-ins/Math/tan/prop-desc.js new file mode 100644 index 0000000000..8c36377414 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-math.tan +description: > + "tan" property of Math +info: | + Section 17: 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(Math, "tan"); +verifyWritable(Math, "tan"); +verifyConfigurable(Math, "tan"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tan/shell.js b/js/src/tests/test262/built-ins/Math/tan/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tan/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/tanh/browser.js b/js/src/tests/test262/built-ins/Math/tanh/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/tanh/length.js b/js/src/tests/test262/built-ins/Math/tanh/length.js new file mode 100644 index 0000000000..7af2c89df5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.tanh +es6id: 20.2.2.34 +info: | + Math.tanh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.tanh.length, 1); + +verifyNotEnumerable(Math.tanh, "length"); +verifyNotWritable(Math.tanh, "length"); +verifyConfigurable(Math.tanh, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tanh/name.js b/js/src/tests/test262/built-ins/Math/tanh/name.js new file mode 100644 index 0000000000..af77bcfae0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.34 +description: > + Math.tanh.name is "tanh". +info: | + Math.tanh ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.tanh.name, "tanh"); + +verifyNotEnumerable(Math.tanh, "name"); +verifyNotWritable(Math.tanh, "name"); +verifyConfigurable(Math.tanh, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js new file mode 100644 index 0000000000..7f4914d650 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.tanh does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.tanh), false, 'isConstructor(Math.tanh) must return false'); + +assert.throws(TypeError, () => { + new Math.tanh(); +}, '`new Math.tanh()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tanh/prop-desc.js b/js/src/tests/test262/built-ins/Math/tanh/prop-desc.js new file mode 100644 index 0000000000..da5b65ed1f --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.tanh +includes: [propertyHelper.js] +es6id: 20.2.2.34 +---*/ + +verifyNotEnumerable(Math, "tanh"); +verifyWritable(Math, "tanh"); +verifyConfigurable(Math, "tanh"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/tanh/shell.js b/js/src/tests/test262/built-ins/Math/tanh/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js b/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js new file mode 100644 index 0000000000..3145214035 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/tanh/tanh-specialVals.js @@ -0,0 +1,20 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.tanh with special values +es6id: 20.2.2.34 +---*/ + +assert.sameValue(Math.tanh(NaN), Number.NaN, + "Math.tanh produces incorrect output for NaN"); +assert.sameValue(Math.tanh(Number.NEGATIVE_INFINITY), -1, + "Math.tanh should produce -1 for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.tanh(Number.POSITIVE_INFINITY), 1, + "Math.tanh should produce 1 for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.tanh(-0), Number.NEGATIVE_INFINITY, + "Math.tanh should produce -0 for -0"); +assert.sameValue(1 / Math.tanh(0), Number.POSITIVE_INFINITY, + "Math.tanh should produce +0 for +0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Infinity.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Infinity.js new file mode 100644 index 0000000000..283ede8ae0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Infinity.js @@ -0,0 +1,13 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Return arg when called with Infinity or -Infinity. +---*/ + +assert.sameValue(Math.trunc(Infinity), Infinity, 'Math.trunc(Infinity)'); +assert.sameValue(Math.trunc(-Infinity), -Infinity, 'Math.trunc(-Infinity)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NaN.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NaN.js new file mode 100644 index 0000000000..be3598e4f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NaN.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Math.trunc should return NaN when called with NaN. +---*/ + +assert.sameValue(Math.trunc(NaN), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NegDecimal.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NegDecimal.js new file mode 100644 index 0000000000..1543bdeefd --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_NegDecimal.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Math.trunc should return -0 if called with a value between 0 and -1. +---*/ + +assert.sameValue(Math.trunc(-.9), -0, 'Math.trunc(-.9)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_PosDecimal.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_PosDecimal.js new file mode 100644 index 0000000000..4a5ec1db63 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_PosDecimal.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Math.trunc should return 0 if called with a value between 0 and 1. +---*/ + +assert.sameValue(Math.trunc(.9), 0, 'Math.trunc(.9)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Success.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Success.js new file mode 100644 index 0000000000..24f2eaa38a --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Success.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Math.trunc should return 4578 if called with 4578.584949 +---*/ + +assert.sameValue(Math.trunc(4578.584949), 4578, 'Math.trunc(4578.584949)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Zero.js b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Zero.js new file mode 100644 index 0000000000..87e4068b6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/Math.trunc_Zero.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +author: Ryan Lewis +description: Math.trunc should return 0 when called with 0. +---*/ + +assert.sameValue(Math.trunc(0), 0, 'Math.trunc(0)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/browser.js b/js/src/tests/test262/built-ins/Math/trunc/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Math/trunc/length.js b/js/src/tests/test262/built-ins/Math/trunc/length.js new file mode 100644 index 0000000000..593f893d82 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/length.js @@ -0,0 +1,27 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: length property of Math.trunc +es6id: 20.2.2.35 +info: | + Math.trunc ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.trunc.length, 1); + +verifyNotEnumerable(Math.trunc, "length"); +verifyNotWritable(Math.trunc, "length"); +verifyConfigurable(Math.trunc, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/name.js b/js/src/tests/test262/built-ins/Math/trunc/name.js new file mode 100644 index 0000000000..25f8a0cc3c --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.2.2.35 +description: > + Math.trunc.name is "trunc". +info: | + Math.trunc ( x ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Math.trunc.name, "trunc"); + +verifyNotEnumerable(Math.trunc, "name"); +verifyNotWritable(Math.trunc, "name"); +verifyConfigurable(Math.trunc, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/not-a-constructor.js b/js/src/tests/test262/built-ins/Math/trunc/not-a-constructor.js new file mode 100644 index 0000000000..1a55c671b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Math.trunc does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Math.trunc), false, 'isConstructor(Math.trunc) must return false'); + +assert.throws(TypeError, () => { + new Math.trunc(); +}, '`new Math.trunc()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/prop-desc.js b/js/src/tests/test262/built-ins/Math/trunc/prop-desc.js new file mode 100644 index 0000000000..a6734854fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/prop-desc.js @@ -0,0 +1,14 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Math.trunc +includes: [propertyHelper.js] +es6id: 20.2.2.35 +---*/ + +verifyNotEnumerable(Math, "trunc"); +verifyWritable(Math, "trunc"); +verifyConfigurable(Math, "trunc"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/shell.js b/js/src/tests/test262/built-ins/Math/trunc/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Math/trunc/trunc-sampleTests.js b/js/src/tests/test262/built-ins/Math/trunc/trunc-sampleTests.js new file mode 100644 index 0000000000..70da243d80 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/trunc-sampleTests.js @@ -0,0 +1,49 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: sample tests for trunc +es6id: 20.2.2.35 +---*/ + +assert.sameValue(1 / Math.trunc(0.02047410048544407), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for values between 0 and 1"); +assert.sameValue(1 / Math.trunc(0.00000000000000001), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for values between 0 and 1"); +assert.sameValue(1 / Math.trunc(0.9999999999999999), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for values between 0 and 1"); +assert.sameValue(1 / Math.trunc(Number.EPSILON), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for values between 0 and 1"); +assert.sameValue(1 / Math.trunc(Number.MIN_VALUE), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for values between 0 and 1"); + +assert.sameValue(1 / Math.trunc(-0.02047410048544407), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for values between -1 and 0"); +assert.sameValue(1 / Math.trunc(-0.00000000000000001), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for values between -1 and 0"); +assert.sameValue(1 / Math.trunc(-0.9999999999999999), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for values between -1 and 0"); +assert.sameValue(1 / Math.trunc(-Number.EPSILON), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for values between -1 and 0"); +assert.sameValue(1 / Math.trunc(-Number.MIN_VALUE), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for values between -1 and 0"); + +assert.sameValue(Math.trunc(Number.MAX_VALUE), Math.floor(Number.MAX_VALUE), + "Math.trunc produces incorrect result for Number.MAX_VALUE"); +assert.sameValue(Math.trunc(10), Math.floor(10), + "Math.trunc produces incorrect result for 10"); +assert.sameValue(Math.trunc(3.9), Math.floor(3.9), + "Math.trunc produces incorrect result for 3.9"); +assert.sameValue(Math.trunc(4.9), Math.floor(4.9), + "Math.trunc produces incorrect result for 4.9"); + +assert.sameValue(Math.trunc(-Number.MAX_VALUE), Math.ceil(-Number.MAX_VALUE), + "Math.trunc produces incorrect result for -Number.MAX_VALUE"); +assert.sameValue(Math.trunc(-10), Math.ceil(-10), + "Math.trunc produces incorrect result for -10"); +assert.sameValue(Math.trunc(-3.9), Math.ceil(-3.9), + "Math.trunc produces incorrect result for -3.9"); +assert.sameValue(Math.trunc(-4.9), Math.ceil(-4.9), + "Math.trunc produces incorrect result for -4.9"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Math/trunc/trunc-specialVals.js b/js/src/tests/test262/built-ins/Math/trunc/trunc-specialVals.js new file mode 100644 index 0000000000..7e6c8c1051 --- /dev/null +++ b/js/src/tests/test262/built-ins/Math/trunc/trunc-specialVals.js @@ -0,0 +1,18 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Math.trunc with sample values. +es6id: 20.2.2.35 +---*/ + +assert.sameValue(Math.trunc(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY, + "Math.trunc should produce negative infinity for Number.NEGATIVE_INFINITY"); +assert.sameValue(Math.trunc(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY, + "Math.trunc should produce positive infinity for Number.POSITIVE_INFINITY"); +assert.sameValue(1 / Math.trunc(-0), Number.NEGATIVE_INFINITY, + "Math.trunc should produce -0 for -0"); +assert.sameValue(1 / Math.trunc(0), Number.POSITIVE_INFINITY, + "Math.trunc should produce +0 for +0"); + +reportCompare(0, 0); -- cgit v1.2.3