From e49d2661a8576eba80921bffa13f5e7cfeed29d9 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Fri, 1 Jul 2016 15:22:55 -0300 Subject: [PATCH] Improve assertions comparing values to NaN (#690) The global isNaN is not precise at all, and Number.isNaN is an ES6 feature that makes it preferrable to use assert's sameValue for NaN values, as it handles it internally using the comparison. --- .../Array/prototype/join/S15.4.4.5_A2_T2.js | 4 +- test/built-ins/Date/S15.9.3.1_A6_T1.js | 61 +++++++--------- test/built-ins/Date/S15.9.3.1_A6_T2.js | 61 +++++++--------- test/built-ins/Date/S15.9.3.1_A6_T3.js | 61 +++++++--------- test/built-ins/Date/S15.9.3.1_A6_T4.js | 61 +++++++--------- test/built-ins/Date/S15.9.3.1_A6_T5.js | 61 +++++++--------- .../Date/prototype/valueOf/S9.4_A3_T2.js | 12 +--- test/built-ins/Math/abs/S15.8.2.1_A1.js | 7 +- test/built-ins/Math/acos/S15.8.2.2_A1.js | 7 +- test/built-ins/Math/acos/S15.8.2.2_A2.js | 23 +----- test/built-ins/Math/acos/S15.8.2.2_A3.js | 23 +----- test/built-ins/Math/asin/S15.8.2.3_A1.js | 7 +- test/built-ins/Math/asin/S15.8.2.3_A2.js | 23 +----- test/built-ins/Math/asin/S15.8.2.3_A3.js | 23 +----- test/built-ins/Math/atan/S15.8.2.4_A1.js | 7 +- test/built-ins/Math/atan2/S15.8.2.5_A1.js | 9 +-- test/built-ins/Math/ceil/S15.8.2.6_A1.js | 7 +- test/built-ins/Math/cos/S15.8.2.7_A1.js | 7 +- test/built-ins/Math/cos/S15.8.2.7_A4.js | 7 +- test/built-ins/Math/cos/S15.8.2.7_A5.js | 7 +- test/built-ins/Math/exp/S15.8.2.8_A1.js | 7 +- test/built-ins/Math/floor/S15.8.2.9_A1.js | 7 +- test/built-ins/Math/fround/Math.fround_NaN.js | 2 +- test/built-ins/Math/hypot/Math.hypot_NaN.js | 2 +- test/built-ins/Math/log/S15.8.2.10_A1.js | 7 +- test/built-ins/Math/log/S15.8.2.10_A2.js | 23 +----- test/built-ins/Math/max/15.8.2.11-1.js | 2 +- test/built-ins/Math/max/S15.8.2.11_A2.js | 24 +++---- test/built-ins/Math/min/15.8.2.12-1.js | 2 +- test/built-ins/Math/min/S15.8.2.12_A2.js | 23 +++--- .../Math/pow/applying-the-exp-operator_A1.js | 9 +-- .../Math/pow/applying-the-exp-operator_A23.js | 13 ++-- .../Math/pow/applying-the-exp-operator_A4.js | 9 +-- .../Math/pow/applying-the-exp-operator_A7.js | 9 +-- .../Math/pow/applying-the-exp-operator_A8.js | 9 +-- test/built-ins/Math/round/S15.8.2.15_A1.js | 7 +- test/built-ins/Math/sin/S15.8.2.16_A1.js | 7 +- test/built-ins/Math/sin/S15.8.2.16_A4.js | 7 +- test/built-ins/Math/sin/S15.8.2.16_A5.js | 7 +- test/built-ins/Math/sqrt/S15.8.2.17_A1.js | 7 +- test/built-ins/Math/sqrt/S15.8.2.17_A2.js | 23 +----- test/built-ins/Math/tan/S15.8.2.18_A1.js | 7 +- test/built-ins/Math/tan/S15.8.2.18_A4.js | 7 +- test/built-ins/Math/tan/S15.8.2.18_A5.js | 7 +- test/built-ins/Math/trunc/Math.trunc_NaN.js | 2 +- test/built-ins/NaN/S15.1.1.1_A1.js | 18 +---- test/built-ins/Number/S15.7.1.1_A1.js | 9 +-- test/built-ins/Number/S9.3_A1_T1.js | 15 +--- test/built-ins/Number/S9.3_A4.2_T1.js | 20 +++--- test/built-ins/Number/S9.3_A5_T1.js | 46 +++++------- .../prototype/valueOf/S15.7.4.4_A1_T01.js | 8 ++- .../prototype/valueOf/S15.7.4.4_A1_T02.js | 8 ++- test/built-ins/Object/S9.9_A4.js | 4 +- .../Object/defineProperty/15.2.3.6-4-63.js | 2 +- .../Object/defineProperty/15.2.3.6-4-85.js | 2 +- .../prototype/charCodeAt/S15.5.4.5_A2.js | 8 +-- .../prototype/charCodeAt/S15.5.4.5_A3.js | 8 +-- .../prototype/sort/sorted-values-nan.js | 8 +-- test/built-ins/parseFloat/15.1.2.3-2-1.js | 1 - test/built-ins/parseFloat/S15.1.2.3_A1_T1.js | 11 +-- test/built-ins/parseFloat/S15.1.2.3_A1_T3.js | 22 +----- test/built-ins/parseFloat/S15.1.2.3_A1_T4.js | 11 +-- test/built-ins/parseFloat/S15.1.2.3_A1_T7.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T1.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T10.js | 5 +- test/built-ins/parseFloat/S15.1.2.3_A2_T2.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T3.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T4.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T5.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T6.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T7.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T8.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A2_T9.js | 4 +- test/built-ins/parseFloat/S15.1.2.3_A3_T1.js | 38 ++-------- test/built-ins/parseFloat/S15.1.2.3_A3_T2.js | 55 ++------------ test/built-ins/parseFloat/S15.1.2.3_A3_T3.js | 43 ++--------- test/built-ins/parseInt/15.1.2.2-2-1.js | 1 - test/built-ins/parseInt/S15.1.2.2_A1_T1.js | 11 +-- test/built-ins/parseInt/S15.1.2.2_A1_T3.js | 21 +----- test/built-ins/parseInt/S15.1.2.2_A1_T4.js | 11 +-- test/built-ins/parseInt/S15.1.2.2_A1_T7.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T1.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T10.js | 5 +- test/built-ins/parseInt/S15.1.2.2_A2_T2.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T3.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T4.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T5.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T6.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T7.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T8.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A2_T9.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A3.1_T1.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A3.1_T4.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A3.2_T3.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A4.2_T1.js | 71 ++++--------------- test/built-ins/parseInt/S15.1.2.2_A4.2_T2.js | 71 ++++--------------- test/built-ins/parseInt/S15.1.2.2_A4.2_T3.js | 23 ------ test/built-ins/parseInt/S15.1.2.2_A7.1_T1.js | 4 +- test/built-ins/parseInt/S15.1.2.2_A7.1_T2.js | 29 ++------ .../applying-the-exp-operator_A1.js | 8 ++- .../applying-the-exp-operator_A23.js | 8 ++- .../applying-the-exp-operator_A4.js | 8 ++- .../applying-the-exp-operator_A7.js | 8 ++- .../applying-the-exp-operator_A8.js | 8 ++- .../language/statements/throw/S12.13_A2_T5.js | 2 +- test/language/statements/try/S12.14_A18_T5.js | 2 +- .../statements/with/S12.10_A1.11_T1.js | 4 +- .../statements/with/S12.10_A1.11_T2.js | 4 +- .../statements/with/S12.10_A1.11_T4.js | 4 +- test/language/types/object/S8.6_A2_T1.js | 4 +- test/language/types/object/S8.6_A2_T2.js | 4 +- test/language/types/object/S8.6_A3_T1.js | 5 +- test/language/types/object/S8.6_A3_T2.js | 4 +- 113 files changed, 397 insertions(+), 1064 deletions(-) delete mode 100644 test/built-ins/parseInt/S15.1.2.2_A4.2_T3.js diff --git a/test/built-ins/Array/prototype/join/S15.4.4.5_A2_T2.js b/test/built-ins/Array/prototype/join/S15.4.4.5_A2_T2.js index 2081d3133d..4df78f4144 100644 --- a/test/built-ins/Array/prototype/join/S15.4.4.5_A2_T2.js +++ b/test/built-ins/Array/prototype/join/S15.4.4.5_A2_T2.js @@ -19,9 +19,7 @@ if (obj.join() !== "") { } //CHECK#2 -if (isNaN(obj.length) !== true) { - $ERROR('#2: var obj = {}; obj.length = NaN; obj.join = Array.prototype.join; obj.join(); obj.length === Not-a-Number. Actual: ' + (obj.length)); -} +assert.sameValue(obj.length, NaN, "obj.length is NaN"); //CHECK#5 obj.length = Number.NEGATIVE_INFINITY; diff --git a/test/built-ins/Date/S15.9.3.1_A6_T1.js b/test/built-ins/Date/S15.9.3.1_A6_T1.js index 37a89a73f5..e944a9a5b6 100644 --- a/test/built-ins/Date/S15.9.3.1_A6_T1.js +++ b/test/built-ins/Date/S15.9.3.1_A6_T1.js @@ -13,50 +13,39 @@ function DateValue(year, month, date, hours, minutes, seconds, ms){ return new Date(year, month, date, hours, minutes, seconds, ms).valueOf(); } -if (!isNaN(DateValue(1899, 11))) { - $ERROR("#1: The value should be NaN"); -} +var x; +x = DateValue(1899, 11); +assert.sameValue(x, NaN, "(1899, 11)"); -if (!isNaN(DateValue(1899, 12))) { - $ERROR("#2: The value should be NaN"); -} +x = DateValue(1899, 12); +assert.sameValue(x, NaN, "(1899, 12)"); -if (!isNaN(DateValue(1900, 0))) { - $ERROR("#3: The value should be NaN"); -} +x = DateValue(1900, 0); +assert.sameValue(x, NaN, "(1900, 0)"); -if (!isNaN(DateValue(1969, 11))) { - $ERROR("#4: The value should be NaN"); -} +x = DateValue(1969, 11); +assert.sameValue(x, NaN, "(1969, 11)"); -if (!isNaN(DateValue(1969, 12))) { - $ERROR("#5: The value should be NaN"); -} +x = DateValue(1969, 12); +assert.sameValue(x, NaN, "(1969, 12)"); -if (!isNaN(DateValue(1970, 0))) { - $ERROR("#6: The value should be NaN"); -} +x = DateValue(1970, 0); +assert.sameValue(x, NaN, "(1970, 0)"); -if (!isNaN(DateValue(1999, 11))) { - $ERROR("#7: The value should be NaN"); -} +x = DateValue(1999, 11); +assert.sameValue(x, NaN, "(1999, 11)"); -if (!isNaN(DateValue(1999, 12))) { - $ERROR("#8: The value should be NaN"); -} +x = DateValue(1999, 12); +assert.sameValue(x, NaN, "(1999, 12)"); -if (!isNaN(DateValue(2000, 0))) { - $ERROR("#9: The value should be NaN"); -} +x = DateValue(2000, 0); +assert.sameValue(x, NaN, "(2000, 0)"); -if (!isNaN(DateValue(2099, 11))) { - $ERROR("#10: The value should be NaN"); -} +x = DateValue(2099, 11); +assert.sameValue(x, NaN, "(2099, 11)"); -if (!isNaN(DateValue(2099, 12))) { - $ERROR("#11: The value should be NaN"); -} +x = DateValue(2099, 12); +assert.sameValue(x, NaN, "(2099, 12)"); -if (!isNaN(DateValue(2100, 0))) { - $ERROR("#12: The value should be NaN"); -} +x = DateValue(2100, 0); +assert.sameValue(x, NaN, "(2100, 0)"); diff --git a/test/built-ins/Date/S15.9.3.1_A6_T2.js b/test/built-ins/Date/S15.9.3.1_A6_T2.js index 0d6650cca3..c0f4d4626d 100644 --- a/test/built-ins/Date/S15.9.3.1_A6_T2.js +++ b/test/built-ins/Date/S15.9.3.1_A6_T2.js @@ -13,50 +13,39 @@ function DateValue(year, month, date, hours, minutes, seconds, ms){ return new Date(year, month, date, hours, minutes, seconds, ms).valueOf(); } -if (!isNaN(DateValue(1899, 11, 31))) { - $ERROR("#1: The value should be NaN"); -} +var x; +x = DateValue(1899, 11, 31); +assert.sameValue(x, NaN, "(1899, 11, 31)"); -if (!isNaN(DateValue(1899, 12, 1))) { - $ERROR("#2: The value should be NaN"); -} +x = DateValue(1899, 12, 1); +assert.sameValue(x, NaN, "(1899, 12, 1)"); -if (!isNaN(DateValue(1900, 0, 1))) { - $ERROR("#3: The value should be NaN"); -} +x = DateValue(1900, 0, 1); +assert.sameValue(x, NaN, "(1900, 0, 1)"); -if (!isNaN(DateValue(1969, 11, 31))) { - $ERROR("#4: The value should be NaN"); -} +x = DateValue(1969, 11, 31); +assert.sameValue(x, NaN, "(1969, 11, 31)"); -if (!isNaN(DateValue(1969, 12, 1))) { - $ERROR("#5: The value should be NaN"); -} +x = DateValue(1969, 12, 1); +assert.sameValue(x, NaN, "(1969, 12, 1)"); -if (!isNaN(DateValue(1970, 0, 1))) { - $ERROR("#6: The value should be NaN"); -} +x = DateValue(1970, 0, 1); +assert.sameValue(x, NaN, "(1970, 0, 1)"); -if (!isNaN(DateValue(1999, 11, 31))) { - $ERROR("#7: The value should be NaN"); -} +x = DateValue(1999, 11, 31); +assert.sameValue(x, NaN, "(1999, 11, 31)"); -if (!isNaN(DateValue(1999, 12, 1))) { - $ERROR("#8: The value should be NaN"); -} +x = DateValue(1999, 12, 1); +assert.sameValue(x, NaN, "(1999, 12, 1)"); -if (!isNaN(DateValue(2000, 0, 1))) { - $ERROR("#9: The value should be NaN"); -} +x = DateValue(2000, 0, 1); +assert.sameValue(x, NaN, "(2000, 0, 1)"); -if (!isNaN(DateValue(2099, 11, 31))) { - $ERROR("#10: The value should be NaN"); -} +x = DateValue(2099, 11, 31); +assert.sameValue(x, NaN, "(2099, 11, 31)"); -if (!isNaN(DateValue(2099, 12, 1))) { - $ERROR("#11: The value should be NaN"); -} +x = DateValue(2099, 12, 1); +assert.sameValue(x, NaN, "(2099, 12, 1)"); -if (!isNaN(DateValue(2100, 0, 1))) { - $ERROR("#12: The value should be NaN"); -} +x = DateValue(2100, 0, 1); +assert.sameValue(x, NaN, "(2100, 0, 1)"); diff --git a/test/built-ins/Date/S15.9.3.1_A6_T3.js b/test/built-ins/Date/S15.9.3.1_A6_T3.js index fdd8b27b54..c6b3b4acf7 100644 --- a/test/built-ins/Date/S15.9.3.1_A6_T3.js +++ b/test/built-ins/Date/S15.9.3.1_A6_T3.js @@ -13,50 +13,39 @@ function DateValue(year, month, date, hours, minutes, seconds, ms){ return new Date(year, month, date, hours, minutes, seconds, ms).valueOf(); } -if (!isNaN(DateValue(1899, 11, 31, 23))) { - $ERROR("#1: The value should be NaN"); -} +var x; +x = DateValue(1899, 11, 31, 23); +assert.sameValue(x, NaN, "(1899, 11, 31, 23)"); -if (!isNaN(DateValue(1899, 12, 1, 0))) { - $ERROR("#2: The value should be NaN"); -} +x = DateValue(1899, 12, 1, 0); +assert.sameValue(x, NaN, "(1899, 12, 1, 0)"); -if (!isNaN(DateValue(1900, 0, 1, 0))) { - $ERROR("#3: The value should be NaN"); -} +x = DateValue(1900, 0, 1, 0); +assert.sameValue(x, NaN, "(1900, 0, 1, 0)"); -if (!isNaN(DateValue(1969, 11, 31, 23))) { - $ERROR("#4: The value should be NaN"); -} +x = DateValue(1969, 11, 31, 23); +assert.sameValue(x, NaN, "(1969, 11, 31, 23)"); -if (!isNaN(DateValue(1969, 12, 1, 0))) { - $ERROR("#5: The value should be NaN"); -} +x = DateValue(1969, 12, 1, 0); +assert.sameValue(x, NaN, "(1969, 12, 1, 0)"); -if (!isNaN(DateValue(1970, 0, 1, 0))) { - $ERROR("#6: The value should be NaN"); -} +x = DateValue(1970, 0, 1, 0); +assert.sameValue(x, NaN, "(1970, 0, 1, 0)"); -if (!isNaN(DateValue(1999, 11, 31, 23))) { - $ERROR("#7: The value should be NaN"); -} +x = DateValue(1999, 11, 31, 23); +assert.sameValue(x, NaN, "(1999, 11, 31, 23)"); -if (!isNaN(DateValue(1999, 12, 1, 0))) { - $ERROR("#8: The value should be NaN"); -} +x = DateValue(1999, 12, 1, 0); +assert.sameValue(x, NaN, "(1999, 12, 1, 0)"); -if (!isNaN(DateValue(2000, 0, 1, 0))) { - $ERROR("#9: The value should be NaN"); -} +x = DateValue(2000, 0, 1, 0); +assert.sameValue(x, NaN, "(2000, 0, 1, 0)"); -if (!isNaN(DateValue(2099, 11, 31, 23))) { - $ERROR("#10: The value should be NaN"); -} +x = DateValue(2099, 11, 31, 23); +assert.sameValue(x, NaN, "(2099, 11, 31, 23)"); -if (!isNaN(DateValue(2099, 12, 1, 0))) { - $ERROR("#11: The value should be NaN"); -} +x = DateValue(2099, 12, 1, 0); +assert.sameValue(x, NaN, "(2099, 12, 1, 0)"); -if (!isNaN(DateValue(2100, 0, 1, 0))) { - $ERROR("#12: The value should be NaN"); -} +x = DateValue(2100, 0, 1, 0); +assert.sameValue(x, NaN, "(2100, 0, 1, 0)"); diff --git a/test/built-ins/Date/S15.9.3.1_A6_T4.js b/test/built-ins/Date/S15.9.3.1_A6_T4.js index b8985e83d7..b5b009fb33 100644 --- a/test/built-ins/Date/S15.9.3.1_A6_T4.js +++ b/test/built-ins/Date/S15.9.3.1_A6_T4.js @@ -13,50 +13,39 @@ function DateValue(year, month, date, hours, minutes, seconds, ms){ return new Date(year, month, date, hours, minutes, seconds, ms).valueOf(); } -if (!isNaN(DateValue(1899, 11, 31, 23, 59))) { - $ERROR("#1: The value should be NaN"); -} +var x; +x = DateValue(1899, 11, 31, 23, 59); +assert.sameValue(x, NaN, "(1899, 11, 31, 23, 59)"); -if (!isNaN(DateValue(1899, 12, 1, 0, 0))) { - $ERROR("#2: The value should be NaN"); -} +x = DateValue(1899, 12, 1, 0, 0); +assert.sameValue(x, NaN, "(1899, 12, 1, 0, 0)"); -if (!isNaN(DateValue(1900, 0, 1, 0, 0))) { - $ERROR("#3: The value should be NaN"); -} +x = DateValue(1900, 0, 1, 0, 0); +assert.sameValue(x, NaN, "(1900, 0, 1, 0, 0)"); -if (!isNaN(DateValue(1969, 11, 31, 23, 59))) { - $ERROR("#4: The value should be NaN"); -} +x = DateValue(1969, 11, 31, 23, 59); +assert.sameValue(x, NaN, "(1969, 11, 31, 23, 59)"); -if (!isNaN(DateValue(1969, 12, 1, 0, 0))) { - $ERROR("#5: The value should be NaN"); -} +x = DateValue(1969, 12, 1, 0, 0); +assert.sameValue(x, NaN, "(1969, 12, 1, 0, 0)"); -if (!isNaN(DateValue(1970, 0, 1, 0, 0))) { - $ERROR("#6: The value should be NaN"); -} +x = DateValue(1970, 0, 1, 0, 0); +assert.sameValue(x, NaN, "(1970, 0, 1, 0, 0)"); -if (!isNaN(DateValue(1999, 11, 31, 23, 59))) { - $ERROR("#7: The value should be NaN"); -} +x = DateValue(1999, 11, 31, 23, 59); +assert.sameValue(x, NaN, "(1999, 11, 31, 23, 59)"); -if (!isNaN(DateValue(1999, 12, 1, 0, 0))) { - $ERROR("#8: The value should be NaN"); -} +x = DateValue(1999, 12, 1, 0, 0); +assert.sameValue(x, NaN, "(1999, 12, 1, 0, 0)"); -if (!isNaN(DateValue(2000, 0, 1, 0, 0))) { - $ERROR("#9: The value should be NaN"); -} +x = DateValue(2000, 0, 1, 0, 0); +assert.sameValue(x, NaN, "(2000, 0, 1, 0, 0)"); -if (!isNaN(DateValue(2099, 11, 31, 23, 59))) { - $ERROR("#10: The value should be NaN"); -} +x = DateValue(2099, 11, 31, 23, 59); +assert.sameValue(x, NaN, "(2099, 11, 31, 23, 59)"); -if (!isNaN(DateValue(2099, 12, 1, 0, 0))) { - $ERROR("#11: The value should be NaN"); -} +x = DateValue(2099, 12, 1, 0, 0); +assert.sameValue(x, NaN, "(2099, 12, 1, 0, 0)"); -if (!isNaN(DateValue(2100, 0, 1, 0, 0))) { - $ERROR("#12: The value should be NaN"); -} +x = DateValue(2100, 0, 1, 0, 0); +assert.sameValue(x, NaN, "(2100, 0, 1, 0, 0)"); diff --git a/test/built-ins/Date/S15.9.3.1_A6_T5.js b/test/built-ins/Date/S15.9.3.1_A6_T5.js index 5b55afb7b7..f76d0207c9 100644 --- a/test/built-ins/Date/S15.9.3.1_A6_T5.js +++ b/test/built-ins/Date/S15.9.3.1_A6_T5.js @@ -13,50 +13,39 @@ function DateValue(year, month, date, hours, minutes, seconds, ms){ return new Date(year, month, date, hours, minutes, seconds, ms).valueOf(); } -if (!isNaN(DateValue(1899, 11, 31, 23, 59, 59))) { - $ERROR("#1: The value should be NaN"); -} +var x; +x = DateValue(1899, 11, 31, 23, 59, 59); +assert.sameValue(x, NaN, "(1899, 11, 31, 23, 59, 59)"); -if (!isNaN(DateValue(1899, 12, 1, 0, 0, 0))) { - $ERROR("#2: The value should be NaN"); -} +x = DateValue(1899, 12, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(1899, 12, 1, 0, 0, 0)"); -if (!isNaN(DateValue(1900, 0, 1, 0, 0, 0))) { - $ERROR("#3: The value should be NaN"); -} +x = DateValue(1900, 0, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(1900, 0, 1, 0, 0, 0)"); -if (!isNaN(DateValue(1969, 11, 31, 23, 59, 59))) { - $ERROR("#4: The value should be NaN"); -} +x = DateValue(1969, 11, 31, 23, 59, 59); +assert.sameValue(x, NaN, "(1969, 11, 31, 23, 59, 59)"); -if (!isNaN(DateValue(1969, 12, 1, 0, 0, 0))) { - $ERROR("#5: The value should be NaN"); -} +x = DateValue(1969, 12, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(1969, 12, 1, 0, 0, 0)"); -if (!isNaN(DateValue(1970, 0, 1, 0, 0, 0))) { - $ERROR("#6: The value should be NaN"); -} +x = DateValue(1970, 0, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(1970, 0, 1, 0, 0, 0)"); -if (!isNaN(DateValue(1999, 11, 31, 23, 59, 59))) { - $ERROR("#7: The value should be NaN"); -} +x = DateValue(1999, 11, 31, 23, 59, 59); +assert.sameValue(x, NaN, "(1999, 11, 31, 23, 59, 59)"); -if (!isNaN(DateValue(1999, 12, 1, 0, 0, 0))) { - $ERROR("#8: The value should be NaN"); -} +x = DateValue(1999, 12, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(1999, 12, 1, 0, 0, 0)"); -if (!isNaN(DateValue(2000, 0, 1, 0, 0, 0))) { - $ERROR("#9: The value should be NaN"); -} +x = DateValue(2000, 0, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(2000, 0, 1, 0, 0, 0)"); -if (!isNaN(DateValue(2099, 11, 31, 23, 59, 59))) { - $ERROR("#10: The value should be NaN"); -} +x = DateValue(2099, 11, 31, 23, 59, 59); +assert.sameValue(x, NaN, "(2099, 11, 31, 23, 59, 59)"); -if (!isNaN(DateValue(2099, 12, 1, 0, 0, 0))) { - $ERROR("#11: The value should be NaN"); -} +x = DateValue(2099, 12, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(2099, 12, 1, 0, 0, 0)"); -if (!isNaN(DateValue(2100, 0, 1, 0, 0, 0))) { - $ERROR("#12: The value should be NaN"); -} +x = DateValue(2100, 0, 1, 0, 0, 0); +assert.sameValue(x, NaN, "(2100, 0, 1, 0, 0, 0)"); diff --git a/test/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js b/test/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js index 3d9d34efb4..7246469585 100644 --- a/test/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js +++ b/test/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js @@ -13,21 +13,15 @@ description: > // CHECK#1 var d1 = new Date(Number.NaN); -if (!isNaN(d1.valueOf())) { - $ERROR('#1: var d1 = new Date(Number.NaN); d1.valueOf() === Number.NaN;'); -} +assert.sameValue(d1.valueOf(), NaN, "NaN"); // CHECK#2 var d2 = new Date(Infinity); -if (!isNaN(d2.valueOf())) { - $ERROR('#2: var d2 = new Date(Infinity); d2.valueOf() === Number.NaN;'); -} +assert.sameValue(d2.valueOf(), NaN, "Infinity"); // CHECK#3 var d3 = new Date(-Infinity); -if (!isNaN(d3.valueOf())) { - $ERROR('#3: var d3 = new Date(-Infinity); d3.valueOf() === Number.NaN;'); -} +assert.sameValue(d3.valueOf(), NaN, "-Infinity"); // CHECK#4 var d4 = new Date(0); diff --git a/test/built-ins/Math/abs/S15.8.2.1_A1.js b/test/built-ins/Math/abs/S15.8.2.1_A1.js index f902de3ea9..bffba9f25b 100644 --- a/test/built-ins/Math/abs/S15.8.2.1_A1.js +++ b/test/built-ins/Math/abs/S15.8.2.1_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.1_A1 description: Checking if Math.abs(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.abs(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.abs(x)) === false'"); -} +assert.sameValue(Math.abs(NaN), NaN); diff --git a/test/built-ins/Math/acos/S15.8.2.2_A1.js b/test/built-ins/Math/acos/S15.8.2.2_A1.js index 9322e15a13..c0b7e0bfa0 100644 --- a/test/built-ins/Math/acos/S15.8.2.2_A1.js +++ b/test/built-ins/Math/acos/S15.8.2.2_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.2_A1 description: Checking if Math.acos(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.acos(x)) === false'"); -} +assert.sameValue(Math.acos(NaN), NaN); diff --git a/test/built-ins/Math/acos/S15.8.2.2_A2.js b/test/built-ins/Math/acos/S15.8.2.2_A2.js index ad756bfb5d..318e9c4cbe 100644 --- a/test/built-ins/Math/acos/S15.8.2.2_A2.js +++ b/test/built-ins/Math/acos/S15.8.2.2_A2.js @@ -7,23 +7,6 @@ es5id: 15.8.2.2_A2 description: Checking if Math.acos(x) is NaN, where x is greater than 1 ---*/ -// CHECK#1 -var x = 1.000000000000001; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#1: 'var x = 1.000000000000001; isNaN(Math.acos(x)) === false'"); -} - -// CHECK#2 -x = 2; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#2: 'x = 2; isNaN(Math.acos(x)) === false'"); -} - -// CHECK#3 -x = +Infinity; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#3: 'x = +Infinity; isNaN(Math.acos(x)) === false'"); -} +assert.sameValue(Math.acos(1.000000000000001), NaN, "1.000000000000001"); +assert.sameValue(Math.acos(2), NaN, "2"); +assert.sameValue(Math.acos(Infinity), NaN, "Infinity"); diff --git a/test/built-ins/Math/acos/S15.8.2.2_A3.js b/test/built-ins/Math/acos/S15.8.2.2_A3.js index 658e8b9a81..36e2c5b471 100644 --- a/test/built-ins/Math/acos/S15.8.2.2_A3.js +++ b/test/built-ins/Math/acos/S15.8.2.2_A3.js @@ -7,23 +7,6 @@ es5id: 15.8.2.2_A3 description: Checking if Math.acos(x) is NaN, where x is less than -1 ---*/ -// CHECK#1 -var x = -1.000000000000001; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#1: 'var x = -1.000000000000001; isNaN(Math.acos(x)) === false'"); -} - -// CHECK#2 -x = -2; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#2: 'x = -2; isNaN(Math.acos(x)) === false'"); -} - -// CHECK#3 -x = -Infinity; -if (!isNaN(Math.acos(x))) -{ - $ERROR("#3: 'x = -Infinity; isNaN(Math.acos(x)) === false'"); -} +assert.sameValue(Math.acos(-1.000000000000001), NaN, "-1.000000000000001"); +assert.sameValue(Math.acos(-2), NaN, "-2"); +assert.sameValue(Math.acos(-Infinity), NaN, "-Infinity"); diff --git a/test/built-ins/Math/asin/S15.8.2.3_A1.js b/test/built-ins/Math/asin/S15.8.2.3_A1.js index 633e232069..6cda2839e7 100644 --- a/test/built-ins/Math/asin/S15.8.2.3_A1.js +++ b/test/built-ins/Math/asin/S15.8.2.3_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.3_A1 description: Checking if Math.asin(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.asin(x)) === false'"); -} +assert.sameValue(Math.asin(NaN), NaN, "NaN"); diff --git a/test/built-ins/Math/asin/S15.8.2.3_A2.js b/test/built-ins/Math/asin/S15.8.2.3_A2.js index 573376f6ae..7508e2c492 100644 --- a/test/built-ins/Math/asin/S15.8.2.3_A2.js +++ b/test/built-ins/Math/asin/S15.8.2.3_A2.js @@ -7,23 +7,6 @@ es5id: 15.8.2.3_A2 description: Checking if Math.asin(x) is NaN, where x is greater than 1 ---*/ -// CHECK#1 -var x = 1.000000000000001; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#1: 'var x = 1.000000000000001; isNaN(Math.asin(x)) === false'"); -} - -// CHECK#2 -x = 2; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#2: 'x = 2; isNaN(Math.asin(x)) === false'"); -} - -// CHECK#3 -x = +Infinity; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#3: 'x = +Infinity; isNaN(Math.asin(x)) === false'"); -} +assert.sameValue(Math.asin(1.000000000000001), NaN, "1.000000000000001"); +assert.sameValue(Math.asin(2), NaN, "2"); +assert.sameValue(Math.asin(Infinity), NaN, "Infinity"); diff --git a/test/built-ins/Math/asin/S15.8.2.3_A3.js b/test/built-ins/Math/asin/S15.8.2.3_A3.js index ba0afc56a4..0879792647 100644 --- a/test/built-ins/Math/asin/S15.8.2.3_A3.js +++ b/test/built-ins/Math/asin/S15.8.2.3_A3.js @@ -7,23 +7,6 @@ es5id: 15.8.2.3_A3 description: Checking if Math.asin(x) is NaN, where x is less than -1 ---*/ -// CHECK#1 -var x = -1.000000000000001; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#1: 'var x = -1.000000000000001; isNaN(Math.asin(x)) === false'"); -} - -// CHECK#2 -x = -2; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#2: 'x = -2; isNaN(Math.asin(x)) === false'"); -} - -// CHECK#3 -x = -Infinity; -if (!isNaN(Math.asin(x))) -{ - $ERROR("#3: 'x = -Infinity; isNaN(Math.asin(x)) === false'"); -} +assert.sameValue(Math.asin(-1.000000000000001), NaN, "-1.000000000000001"); +assert.sameValue(Math.asin(-2), NaN, "-2"); +assert.sameValue(Math.asin(-Infinity), NaN, "-Infinity"); diff --git a/test/built-ins/Math/atan/S15.8.2.4_A1.js b/test/built-ins/Math/atan/S15.8.2.4_A1.js index caa6de3ccd..efa9398400 100644 --- a/test/built-ins/Math/atan/S15.8.2.4_A1.js +++ b/test/built-ins/Math/atan/S15.8.2.4_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.4_A1 description: Checking if Math.atan(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.atan(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.atan(x)) === false'"); -} +assert.sameValue(Math.atan(NaN), NaN); diff --git a/test/built-ins/Math/atan2/S15.8.2.5_A1.js b/test/built-ins/Math/atan2/S15.8.2.5_A1.js index a9dde9d6a5..0b1d92a2a2 100644 --- a/test/built-ins/Math/atan2/S15.8.2.5_A1.js +++ b/test/built-ins/Math/atan2/S15.8.2.5_A1.js @@ -28,9 +28,10 @@ for (var i = 0; i < 2; i++) for (var j = 0; j < valnum; j++) { args[1-i] = vals[j]; - if (!isNaN(Math.atan2(args[0], args[1]))) - { - $ERROR("#1: isNaN(Math.atan2(" + args[0] + ", " + args[1] + ")) === false'"); - } + assert.sameValue( + Math.atan2(args[0], args[1]), + NaN, + "(" + args[0] + ", " + args[1] + ")" + ); } } diff --git a/test/built-ins/Math/ceil/S15.8.2.6_A1.js b/test/built-ins/Math/ceil/S15.8.2.6_A1.js index 8a33246aed..55fc1b73b4 100644 --- a/test/built-ins/Math/ceil/S15.8.2.6_A1.js +++ b/test/built-ins/Math/ceil/S15.8.2.6_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.6_A1 description: Checking if Math.ceil(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.ceil(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.ceil(x)) === false'"); -} +assert.sameValue(Math.ceil(NaN), NaN); diff --git a/test/built-ins/Math/cos/S15.8.2.7_A1.js b/test/built-ins/Math/cos/S15.8.2.7_A1.js index 7782278667..365f815f40 100644 --- a/test/built-ins/Math/cos/S15.8.2.7_A1.js +++ b/test/built-ins/Math/cos/S15.8.2.7_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.7_A1 description: Checking if Math.cos(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.cos(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.cos(x)) === false'"); -} +assert.sameValue(Math.cos(NaN), NaN); diff --git a/test/built-ins/Math/cos/S15.8.2.7_A4.js b/test/built-ins/Math/cos/S15.8.2.7_A4.js index cdec985312..31a5efcb24 100644 --- a/test/built-ins/Math/cos/S15.8.2.7_A4.js +++ b/test/built-ins/Math/cos/S15.8.2.7_A4.js @@ -7,9 +7,4 @@ es5id: 15.8.2.7_A4 description: Checking if Math.cos(+Infinity) is NaN ---*/ -// CHECK#1 -var x = +Infinity; -if (!isNaN(Math.cos(x))) -{ - $ERROR("#1: 'var x = +Infinity; isNaN(Math.cos(x)) === false'"); -} +assert.sameValue(Math.cos(Infinity), NaN); diff --git a/test/built-ins/Math/cos/S15.8.2.7_A5.js b/test/built-ins/Math/cos/S15.8.2.7_A5.js index 7c34d8ec61..23fbe20ca3 100644 --- a/test/built-ins/Math/cos/S15.8.2.7_A5.js +++ b/test/built-ins/Math/cos/S15.8.2.7_A5.js @@ -7,9 +7,4 @@ es5id: 15.8.2.7_A5 description: Checking if Math.cos(-Infinity) is NaN ---*/ -// CHECK#1 -var x = -Infinity; -if (!isNaN(Math.cos(x))) -{ - $ERROR("#1: 'var x = -Infinity; isNaN(Math.cos(x)) === false'"); -} +assert.sameValue(Math.cos(-Infinity), NaN); diff --git a/test/built-ins/Math/exp/S15.8.2.8_A1.js b/test/built-ins/Math/exp/S15.8.2.8_A1.js index f04343598d..ac0db19928 100644 --- a/test/built-ins/Math/exp/S15.8.2.8_A1.js +++ b/test/built-ins/Math/exp/S15.8.2.8_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.8_A1 description: Checking if Math.exp(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.exp(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.exp(x)) === false'"); -} +assert.sameValue(Math.exp(NaN), NaN); diff --git a/test/built-ins/Math/floor/S15.8.2.9_A1.js b/test/built-ins/Math/floor/S15.8.2.9_A1.js index 43ede91801..d6ada404bf 100644 --- a/test/built-ins/Math/floor/S15.8.2.9_A1.js +++ b/test/built-ins/Math/floor/S15.8.2.9_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.9_A1 description: Checking if Math.floor(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.floor(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.floor(x)) === false'"); -} +assert.sameValue(Math.floor(NaN), NaN); diff --git a/test/built-ins/Math/fround/Math.fround_NaN.js b/test/built-ins/Math/fround/Math.fround_NaN.js index 6023333373..599dba56e3 100644 --- a/test/built-ins/Math/fround/Math.fround_NaN.js +++ b/test/built-ins/Math/fround/Math.fround_NaN.js @@ -7,4 +7,4 @@ author: Ryan Lewis description: Math.fround should return NaN if called with NaN. ---*/ -assert(Number.isNaN(Math.fround(NaN)), 'Number.isNaN(Math.fround(NaN)) !== true'); +assert.sameValue(Math.fround(NaN), NaN); diff --git a/test/built-ins/Math/hypot/Math.hypot_NaN.js b/test/built-ins/Math/hypot/Math.hypot_NaN.js index 0f29e79ae7..1a0113ff0b 100644 --- a/test/built-ins/Math/hypot/Math.hypot_NaN.js +++ b/test/built-ins/Math/hypot/Math.hypot_NaN.js @@ -9,4 +9,4 @@ description: > NaN. ---*/ -assert(Number.isNaN(Math.hypot(NaN, 3)), 'Number.isNaN(Math.hypot(NaN, 3)) !== true'); +assert.sameValue(Math.hypot(NaN, 3), NaN); diff --git a/test/built-ins/Math/log/S15.8.2.10_A1.js b/test/built-ins/Math/log/S15.8.2.10_A1.js index 3e1f9e0f7a..1332f2988c 100644 --- a/test/built-ins/Math/log/S15.8.2.10_A1.js +++ b/test/built-ins/Math/log/S15.8.2.10_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.10_A1 description: Checking if Math.log(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.log(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.log(x)) === false'"); -} +assert.sameValue(Math.log(NaN), NaN); diff --git a/test/built-ins/Math/log/S15.8.2.10_A2.js b/test/built-ins/Math/log/S15.8.2.10_A2.js index 94ef744447..25c73f493f 100644 --- a/test/built-ins/Math/log/S15.8.2.10_A2.js +++ b/test/built-ins/Math/log/S15.8.2.10_A2.js @@ -7,23 +7,6 @@ es5id: 15.8.2.10_A2 description: Checking if Math.log(x) is NaN, where x is less than 0 ---*/ -// CHECK#1 -var x = -0.000000000000001; -if (!isNaN(Math.log(x))) -{ - $ERROR("#1: 'var x=-0.000000000000001; isNaN(Math.log(x)) === false'"); -} - -// CHECK#2 -x = -1; -if (!isNaN(Math.log(x))) -{ - $ERROR("#1: 'var x=-1; isNaN(Math.log(x)) === false'"); -} - -// CHECK#3 -x = -Infinity; -if (!isNaN(Math.log(x))) -{ - $ERROR("#1: 'var x=-Infinity; isNaN(Math.log(x)) === false'"); -} +assert.sameValue(Math.log(-0.000000000000001), NaN, "-0.000000000000001"); +assert.sameValue(Math.log(-1), NaN, "-1"); +assert.sameValue(Math.log(-Infinity), NaN, "-Infinity"); diff --git a/test/built-ins/Math/max/15.8.2.11-1.js b/test/built-ins/Math/max/15.8.2.11-1.js index f2b6e97c83..ae01d3f96e 100644 --- a/test/built-ins/Math/max/15.8.2.11-1.js +++ b/test/built-ins/Math/max/15.8.2.11-1.js @@ -6,4 +6,4 @@ es5id: 15.8.2.11-1 description: Math.max({}) is NaN ---*/ -assert(isNaN(Math.max({})), 'isNaN(Math.max({})) !== true'); +assert.sameValue(Math.max({}), NaN); diff --git a/test/built-ins/Math/max/S15.8.2.11_A2.js b/test/built-ins/Math/max/S15.8.2.11_A2.js index a719f84056..04aea82ec7 100644 --- a/test/built-ins/Math/max/S15.8.2.11_A2.js +++ b/test/built-ins/Math/max/S15.8.2.11_A2.js @@ -9,11 +9,7 @@ description: > function where at least one of the arguments is NaN ---*/ -// CHECK#1 -if (!isNaN(Math.max(NaN))) -{ - $ERROR("#1: 'isNaN(Math.max(NaN)) === false"); -} +assert.sameValue(Math.max(NaN), NaN, "NaN"); // CHECK#2 var vals = new Array(); @@ -33,10 +29,11 @@ for (var i = 0; i <= 1; i++) for (var j = 0; j < valnum; j++) { args[1-i] = vals[j]; - if (!isNaN(Math.max(args[0], args[1]))) - { - $ERROR("#2: 'isNaN(Math.max(" + args[0] + ", " + args[1] + ")) === false"); - } + assert.sameValue( + Math.max(args[0], args[1]), + NaN, + "max(" + args[0] + ", " + args[1] + ")" + ); } } @@ -59,10 +56,11 @@ for (var i = 0; i <= 2; i++) { args[k] = vals[j]; args[l] = vals[jj]; - if (!isNaN(Math.max(args[0], args[1], args[2]))) - { - $ERROR("#3: 'isNaN(Math.max(" + args[0] + ", " + args[1] + ", " + args[2] + ")) === false"); - } + assert.sameValue( + Math.max(args[0], args[1], args[2]), + NaN, + "max(" + args[0] + ", " + args[1] + ", " + args[2] + ")" + ); } } } diff --git a/test/built-ins/Math/min/15.8.2.12-1.js b/test/built-ins/Math/min/15.8.2.12-1.js index cc749e56d3..588d17a7ec 100644 --- a/test/built-ins/Math/min/15.8.2.12-1.js +++ b/test/built-ins/Math/min/15.8.2.12-1.js @@ -6,4 +6,4 @@ es5id: 15.8.2.12-1 description: Math.min({}) is NaN ---*/ -assert(isNaN(Math.min({})), 'isNaN(Math.min({})) !== true'); +assert.sameValue(Math.min({}), NaN); diff --git a/test/built-ins/Math/min/S15.8.2.12_A2.js b/test/built-ins/Math/min/S15.8.2.12_A2.js index 5e5e4eaa2e..3ec27bf76f 100644 --- a/test/built-ins/Math/min/S15.8.2.12_A2.js +++ b/test/built-ins/Math/min/S15.8.2.12_A2.js @@ -10,10 +10,7 @@ description: > ---*/ // CHECK#1 -if (!isNaN(Math.min(NaN))) -{ - $ERROR("#1: 'isNaN(Math.min(NaN)) === false"); -} +assert.sameValue(Math.min(NaN), NaN, "NaN"); // CHECK#2 var vals = new Array(); @@ -33,10 +30,11 @@ for (var i = 0; i <= 1; i++) for (var j = 0; j < valnum; j++) { args[1-i] = vals[j]; - if (!isNaN(Math.min(args[0], args[1]))) - { - $ERROR("#2: 'isNaN(Math.min(" + args[0] + ", " + args[1] + ")) === false"); - } + assert.sameValue( + Math.min(args[0], args[1]), + NaN, + "min(" + args[0] + ", " + args[1] + ")" + ); } } @@ -59,10 +57,11 @@ for (var i = 0; i <= 2; i++) { args[k] = vals[j]; args[l] = vals[jj]; - if (!isNaN(Math.min(args[0], args[1], args[2]))) - { - $ERROR("#3: 'isNaN(Math.min(" + args[0] + ", " + args[1] + ", " + args[2] + ")) === false"); - } + assert.sameValue( + Math.min(args[0], args[1], args[2]), + NaN, + "min(" + args[0] + ", " + args[1] + ", " + args[2] + ")" + ); } } } diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A1.js b/test/built-ins/Math/pow/applying-the-exp-operator_A1.js index 1ee20d1b25..838ba78f3a 100644 --- a/test/built-ins/Math/pow/applying-the-exp-operator_A1.js +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A1.js @@ -22,8 +22,9 @@ var basenum = 9; for (var i = 0; i < basenum; i++) { - if (!isNaN(Math.pow(base[i],exponent))) - { - $ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false"); - } + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + base[i] + ); } diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A23.js b/test/built-ins/Math/pow/applying-the-exp-operator_A23.js index 2849c01ac9..826a4305bb 100644 --- a/test/built-ins/Math/pow/applying-the-exp-operator_A23.js +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A23.js @@ -26,7 +26,12 @@ exponent[7] = Math.PI; var exponentnum = 8; -for (var i = 0; i < basenum; i++) - for (var j = 0; j < exponentnum; j++) - if (!isNaN(Math.pow(base[i],exponent[j]))) - $ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent[j] + ")) === false"); +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] + ")" + ); + } +} diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A4.js b/test/built-ins/Math/pow/applying-the-exp-operator_A4.js index 3c28de4630..7288b105b8 100644 --- a/test/built-ins/Math/pow/applying-the-exp-operator_A4.js +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A4.js @@ -20,8 +20,9 @@ var exponentnum = 7; for (var i = 0; i < exponentnum; i++) { - if (!isNaN(Math.pow(base,exponent[i]))) - { - $ERROR("#1: isNaN(Math.pow(" + base + ", " + exponent[i] + ")) === false"); - } + assert.sameValue( + Math.pow(base, exponent[i]), + NaN, + "(" + base + ", " + exponent[i] + ")" + ); } diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A7.js b/test/built-ins/Math/pow/applying-the-exp-operator_A7.js index f8045d2071..aa736c972b 100644 --- a/test/built-ins/Math/pow/applying-the-exp-operator_A7.js +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A7.js @@ -15,8 +15,9 @@ var basenum = 2; for (var i = 0; i < basenum; i++) { - if (!isNaN(Math.pow(base[i],exponent))) - { - $ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false"); - } + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); } diff --git a/test/built-ins/Math/pow/applying-the-exp-operator_A8.js b/test/built-ins/Math/pow/applying-the-exp-operator_A8.js index 11490df4a9..e87cd290c2 100644 --- a/test/built-ins/Math/pow/applying-the-exp-operator_A8.js +++ b/test/built-ins/Math/pow/applying-the-exp-operator_A8.js @@ -15,8 +15,9 @@ var basenum = 2; for (var i = 0; i < basenum; i++) { - if (!isNaN(Math.pow(base[i],exponent))) - { - $ERROR("#1: isNaN(Math.pow(" + base[i] + ", " + exponent + ")) === false"); - } + assert.sameValue( + Math.pow(base[i], exponent), + NaN, + "(" + base[i] + ", " + exponent + ")" + ); } diff --git a/test/built-ins/Math/round/S15.8.2.15_A1.js b/test/built-ins/Math/round/S15.8.2.15_A1.js index 3246ec446c..2b0e9ba42c 100644 --- a/test/built-ins/Math/round/S15.8.2.15_A1.js +++ b/test/built-ins/Math/round/S15.8.2.15_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.15_A1 description: Checking if Math.round(x) is NaN, where x is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.round(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.round(x)) === false'"); -} +assert.sameValue(Math.round(NaN), NaN); diff --git a/test/built-ins/Math/sin/S15.8.2.16_A1.js b/test/built-ins/Math/sin/S15.8.2.16_A1.js index a64ed50fc3..b8df6cf12b 100644 --- a/test/built-ins/Math/sin/S15.8.2.16_A1.js +++ b/test/built-ins/Math/sin/S15.8.2.16_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.16_A1 description: Checking if Math.sin(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.sin(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.sin(x)) === false'"); -} +assert.sameValue(Math.sin(NaN), NaN); diff --git a/test/built-ins/Math/sin/S15.8.2.16_A4.js b/test/built-ins/Math/sin/S15.8.2.16_A4.js index 0f0cbdbb9f..e016296af9 100644 --- a/test/built-ins/Math/sin/S15.8.2.16_A4.js +++ b/test/built-ins/Math/sin/S15.8.2.16_A4.js @@ -7,9 +7,4 @@ es5id: 15.8.2.16_A4 description: Checking if Math.sin(+Infinity) is NaN ---*/ -// CHECK#1 -var x = +Infinity; -if (!isNaN(Math.sin(x))) -{ - $ERROR("#1: 'var x = +Infinity; isNaN(Math.sin(x)) === false'"); -} +assert.sameValue(Math.sin(Infinity), NaN); diff --git a/test/built-ins/Math/sin/S15.8.2.16_A5.js b/test/built-ins/Math/sin/S15.8.2.16_A5.js index 1a94d8650f..4f5d513454 100644 --- a/test/built-ins/Math/sin/S15.8.2.16_A5.js +++ b/test/built-ins/Math/sin/S15.8.2.16_A5.js @@ -7,9 +7,4 @@ es5id: 15.8.2.16_A5 description: Checking if Math.sin(-Infinity) is NaN ---*/ -// CHECK#1 -var x = -Infinity; -if (!isNaN(Math.sin(x))) -{ - $ERROR("#1: 'var x = -Infinity; isNaN(Math.sin(x)) === false'"); -} +assert.sameValue(Math.sin(-Infinity), NaN); diff --git a/test/built-ins/Math/sqrt/S15.8.2.17_A1.js b/test/built-ins/Math/sqrt/S15.8.2.17_A1.js index 937b23b397..9d2eafd0b7 100644 --- a/test/built-ins/Math/sqrt/S15.8.2.17_A1.js +++ b/test/built-ins/Math/sqrt/S15.8.2.17_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.17_A1 description: Checking if Math.sqrt(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.sqrt(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.sqrt(x)) === false'"); -} +assert.sameValue(Math.sqrt(NaN), NaN); diff --git a/test/built-ins/Math/sqrt/S15.8.2.17_A2.js b/test/built-ins/Math/sqrt/S15.8.2.17_A2.js index 9f40206d30..4e3296ea33 100644 --- a/test/built-ins/Math/sqrt/S15.8.2.17_A2.js +++ b/test/built-ins/Math/sqrt/S15.8.2.17_A2.js @@ -7,23 +7,6 @@ es5id: 15.8.2.17_A2 description: Checking if Math.sqrt(x) is NaN, where x is less than 0 ---*/ -// CHECK#1 -var x = -0.000000000000001; -if (!isNaN(Math.sqrt(x))) -{ - $ERROR("#1: 'var x=-0.000000000000001; isNaN(Math.sqrt(x)) === false'"); -} - -// CHECK#2 -var x = -1; -if (!isNaN(Math.sqrt(x))) -{ - $ERROR("#2: 'var x=-1; isNaN(Math.sqrt(x)) === false'"); -} - -// CHECK#3 -var x = -Infinity; -if (!isNaN(Math.sqrt(x))) -{ - $ERROR("#3: 'var x=-Infinity; isNaN(Math.sqrt(x)) === false'"); -} +assert.sameValue(Math.sqrt(-0.000000000000001), NaN, "-0.000000000000001"); +assert.sameValue(Math.sqrt(-1), NaN, "-1"); +assert.sameValue(Math.sqrt(-Infinity), NaN, "-Infinity"); diff --git a/test/built-ins/Math/tan/S15.8.2.18_A1.js b/test/built-ins/Math/tan/S15.8.2.18_A1.js index bb105205bd..0d51ce7117 100644 --- a/test/built-ins/Math/tan/S15.8.2.18_A1.js +++ b/test/built-ins/Math/tan/S15.8.2.18_A1.js @@ -7,9 +7,4 @@ es5id: 15.8.2.18_A1 description: Checking if Math.tan(NaN) is NaN ---*/ -// CHECK#1 -var x = NaN; -if (!isNaN(Math.tan(x))) -{ - $ERROR("#1: 'var x=NaN; isNaN(Math.tan(x)) === false'"); -} +assert.sameValue(Math.tan(NaN), NaN); diff --git a/test/built-ins/Math/tan/S15.8.2.18_A4.js b/test/built-ins/Math/tan/S15.8.2.18_A4.js index c729280aa6..33293c8d7c 100644 --- a/test/built-ins/Math/tan/S15.8.2.18_A4.js +++ b/test/built-ins/Math/tan/S15.8.2.18_A4.js @@ -7,9 +7,4 @@ es5id: 15.8.2.18_A4 description: Checking if Math.tan(+Infinity) is NaN ---*/ -// CHECK#1 -var x = +Infinity; -if (!isNaN(Math.tan(x))) -{ - $ERROR("#1: 'var x=+Infinity; isNaN(Math.tan(x)) === false'"); -} +assert.sameValue(Math.tan(Infinity), NaN); diff --git a/test/built-ins/Math/tan/S15.8.2.18_A5.js b/test/built-ins/Math/tan/S15.8.2.18_A5.js index 8bd6f21c3b..c875303692 100644 --- a/test/built-ins/Math/tan/S15.8.2.18_A5.js +++ b/test/built-ins/Math/tan/S15.8.2.18_A5.js @@ -7,9 +7,4 @@ es5id: 15.8.2.18_A5 description: Checking if Math.tan(-Infinity) is NaN ---*/ -// CHECK#1 -var x = -Infinity; -if (!isNaN(Math.tan(x))) -{ - $ERROR("#1: 'var x=-Infinity; isNaN(Math.tan(x)) === false'"); -} +assert.sameValue(Math.tan(-Infinity), NaN); diff --git a/test/built-ins/Math/trunc/Math.trunc_NaN.js b/test/built-ins/Math/trunc/Math.trunc_NaN.js index 485b532177..8aec3e0a06 100644 --- a/test/built-ins/Math/trunc/Math.trunc_NaN.js +++ b/test/built-ins/Math/trunc/Math.trunc_NaN.js @@ -7,4 +7,4 @@ author: Ryan Lewis description: Math.trunc should return NaN when called with NaN. ---*/ -assert(Number.isNaN(Math.trunc(NaN)), 'Number.isNaN(Math.trunc(NaN)) !== true'); +assert.sameValue(Math.trunc(NaN), NaN); diff --git a/test/built-ins/NaN/S15.1.1.1_A1.js b/test/built-ins/NaN/S15.1.1.1_A1.js index ee487c4f3a..38d65eb130 100644 --- a/test/built-ins/NaN/S15.1.1.1_A1.js +++ b/test/built-ins/NaN/S15.1.1.1_A1.js @@ -2,22 +2,8 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -info: The initial value of NaN is NaN es5id: 15.1.1.1_A1 -description: Use typeof, isNaN, isFinite +description: The initial value of NaN is NaN ---*/ -// CHECK#1 -if (typeof(NaN) !== "number") { - $ERROR('#1: typeof(NaN) === "number". Actual: ' + (typeof(NaN))); -} - -// CHECK#2 -if (isNaN(NaN) !== true) { - $ERROR('#2: NaN === Not-a-Number. Actual: ' + (NaN)); -} - -// CHECK#3 -if (isFinite(NaN) !== false) { - $ERROR('#3: NaN === Not-a-Finite. Actual: ' + (NaN)); -} +assert(NaN !== NaN); diff --git a/test/built-ins/Number/S15.7.1.1_A1.js b/test/built-ins/Number/S15.7.1.1_A1.js index 8942fb3fb2..d84ded2cb9 100644 --- a/test/built-ins/Number/S15.7.1.1_A1.js +++ b/test/built-ins/Number/S15.7.1.1_A1.js @@ -30,11 +30,4 @@ if( typeof Number(new Object(10)) !== "number" ) { } //CHECK #5 -if( typeof Number("abc") !== "number" ) { - $ERROR('#5: typeof Number("abc") should be "number", actual is "'+typeof Number("abc")+'"'); -} - -//CHECK #6 -if( !isNaN(Number("abc"))) { - $ERROR('#6: Number("abc")) should be NaN'); -} +assert.sameValue(Number("abc"), NaN, "Number('abc')"); diff --git a/test/built-ins/Number/S9.3_A1_T1.js b/test/built-ins/Number/S9.3_A1_T1.js index cd22aa04ac..0051c0803a 100644 --- a/test/built-ins/Number/S9.3_A1_T1.js +++ b/test/built-ins/Number/S9.3_A1_T1.js @@ -7,17 +7,4 @@ es5id: 9.3_A1_T1 description: Undefined convert to Number by explicit transformation ---*/ -// CHECK#1 -if (isNaN(Number(undefined)) !== true) { - $ERROR('#1: Number(undefined) === Not-a-Number. Actual: ' + (Number(undefined))); -} - -// CHECK#2 -if (isNaN(Number(void 0)) !== true) { - $ERROR('#2: Number(void 0) === Not-a-Number. Actual: ' + (Number(void 0))); -} - -// CHECK#3 -if (isNaN(Number(eval("var x"))) !== true) { - $ERROR('#3: Number(eval("var x")) === Not-a-Number. Actual: ' + (Number(eval("var x")))); -} +assert.sameValue(Number(undefined), NaN); diff --git a/test/built-ins/Number/S9.3_A4.2_T1.js b/test/built-ins/Number/S9.3_A4.2_T1.js index a123d98745..ce66684d7c 100644 --- a/test/built-ins/Number/S9.3_A4.2_T1.js +++ b/test/built-ins/Number/S9.3_A4.2_T1.js @@ -13,44 +13,42 @@ description: > ---*/ // CHECK#1 -if (isNaN(Number(Number.NaN)) !== true) { - $ERROR('#1: Number(NaN) === Not-a-Number. Actual: ' + (Number(NaN))); -} +assert.sameValue(Number(NaN), NaN, "NaN"); // CHECK#2 if (Number(+0) !== +0) { - $ERROR('#2.1: Number(+0) === 0. Actual: ' + (Number(+0))); + $ERROR('#2.1: Number(+0) === 0. Actual: ' + (Number(+0))); } else { if (1/Number(+0) !== Number.POSITIVE_INFINITY) { $ERROR('#2.2: Number(+0) === +0. Actual: -0'); - } + } } // CHECK#3 if (Number(-0) !== -0) { - $ERROR('#3.1: Number(-0) === 0. Actual: ' + (Number(-0))); + $ERROR('#3.1: Number(-0) === 0. Actual: ' + (Number(-0))); } else { if (1/Number(-0) !== Number.NEGATIVE_INFINITY) { $ERROR('#3.2: Number(-0) === -0. Actual: +0'); - } + } } // CHECK#4 if (Number(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { - $ERROR('#4: Number(+Infinity) === +Infinity. Actual: ' + (Number(+Infinity))); + $ERROR('#4: Number(+Infinity) === +Infinity. Actual: ' + (Number(+Infinity))); } // CHECK#5 if (Number(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { - $ERROR('#5: Number(-Infinity) === -Infinity. Actual: ' + (Number(-Infinity))); + $ERROR('#5: Number(-Infinity) === -Infinity. Actual: ' + (Number(-Infinity))); } // CHECK#6 if (Number(Number.MAX_VALUE) !== Number.MAX_VALUE) { - $ERROR('#6: Number(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (Number(Number.MAX_VALUE))); + $ERROR('#6: Number(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (Number(Number.MAX_VALUE))); } // CHECK#7 if (Number(Number.MIN_VALUE) !== Number.MIN_VALUE) { - $ERROR('#7: Number(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (Number(Number.MIN_VALUE))); + $ERROR('#7: Number(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (Number(Number.MIN_VALUE))); } diff --git a/test/built-ins/Number/S9.3_A5_T1.js b/test/built-ins/Number/S9.3_A5_T1.js index 739d701343..d6e2c2f7dc 100644 --- a/test/built-ins/Number/S9.3_A5_T1.js +++ b/test/built-ins/Number/S9.3_A5_T1.js @@ -23,23 +23,19 @@ if (Number(new Number(0)) !== 0) { } // CHECK#3 -if (isNaN(Number(new Number(Number.NaN)) !== true)) { - $ERROR('#3: Number(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (Number(new Number(Number.NaN)))); -} +assert.sameValue(Number(new Number(NaN)), NaN, "Number(new Number(NaN)"); // CHECK#4 if (Number(new Number(null)) !== 0) { - $ERROR('#4.1: Number(new Number(null)) === 0. Actual: ' + (Number(new Number(null)))); + $ERROR('#4.1: Number(new Number(null)) === 0. Actual: ' + (Number(new Number(null)))); } else { if (1/Number(new Number(null)) !== Number.POSITIVE_INFINITY) { $ERROR('#4.2: Number(new Number(null)) === +0. Actual: -0'); - } + } } // CHECK#5 -if (isNaN(Number(new Number(void 0)) !== true)) { - $ERROR('#5: Number(new Number(void 0)) === Not-a-Number. Actual: ' + (Number(new Number(void 0)))); -} +assert.sameValue(Number(new Number(void 0)), NaN, "Number(new Number(void 0)"); // CHECK#6 if (Number(new Number(true)) !== 1) { @@ -70,26 +66,22 @@ if (Number(new Boolean(false)) !== +0) { } // CHECK#10 -if (isNaN(Number(new Array(2,4,8,16,32))) !== true) { - $ERROR('#10: Number(new Array(2,4,8,16,32)) === Not-a-Number. Actual: ' + (Number(new Array(2,4,8,16,32)))); -} +assert.sameValue(Number(new Array(2,4,8,16,32)), NaN, "Number(new Array(2,4,8,16,32))"); // CHECK#11 var myobj1 = { - ToNumber : function(){return 12345;}, + ToNumber : function(){return 12345;}, toString : function(){return "67890";}, - valueOf : function(){return "[object MyObj]";} + valueOf : function(){return "[object MyObj]";} }; -if (isNaN(Number(myobj1)) !== true){ - $ERROR("#11: Number(myobj1) calls ToPrimitive with hint Number. Actual: " + (Number(myobj1))); -} +assert.sameValue(Number(myobj1), NaN, "Number(myobj1)"); // CHECK#12 var myobj2 = { - ToNumber : function(){return 12345;}, + ToNumber : function(){return 12345;}, toString : function(){return "67890";}, - valueOf : function(){return "9876543210";} + valueOf : function(){return "9876543210";} }; if (Number(myobj2) !== 9876543210){ @@ -99,18 +91,16 @@ if (Number(myobj2) !== 9876543210){ // CHECK#13 var myobj3 = { - ToNumber : function(){return 12345;}, - toString : function(){return "[object MyObj]";} + ToNumber : function(){return 12345;}, + toString : function(){return "[object MyObj]";} }; -if (isNaN(Number(myobj3)) !== true){ - $ERROR("#13: Number(myobj3) calls ToPrimitive with hint Number. Exptected: Not-a-Number. Actual: " + (Number(myobj3))); -} +assert.sameValue(Number(myobj3), NaN, "Number(myobj3)"); // CHECK#14 var myobj4 = { - ToNumber : function(){return 12345;}, - toString : function(){return "67890";} + ToNumber : function(){return 12345;}, + toString : function(){return "67890";} }; if (Number(myobj4) !== 67890){ @@ -119,9 +109,7 @@ if (Number(myobj4) !== 67890){ // CHECK#15 var myobj5 = { - ToNumber : function(){return 12345;} + ToNumber : function(){return 12345;} }; -if (isNaN(Number(myobj5)) !== true){ - $ERROR("#15: Number(myobj5) calls ToPrimitive with hint Number. Exptected: Not-a-Number. Actual: " + (Number(myobj5))); -} +assert.sameValue(Number(myobj5), NaN, "Number(myobj5)"); diff --git a/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T01.js b/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T01.js index e6fc4d41de..1345810ac7 100644 --- a/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T01.js +++ b/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T01.js @@ -33,9 +33,11 @@ if((new Number(1)).valueOf() !== 1){ } //CHECK#6 -if(!isNaN((new Number(Number.NaN)).valueOf())){ - $ERROR('#6: (new Number(Number.NaN)).valueOf() === NaN'); -} +assert.sameValue( + new Number(NaN).valueOf(), + NaN, + "NaN" +); //CHECK#7 if((new Number(Number.POSITIVE_INFINITY)).valueOf() !== Number.POSITIVE_INFINITY){ diff --git a/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T02.js b/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T02.js index ce82e1f0c9..4f4a443894 100644 --- a/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T02.js +++ b/test/built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T02.js @@ -33,9 +33,11 @@ if((new Number(1)).valueOf("argument") !== 1){ } //CHECK#6 -if(!isNaN((new Number(Number.NaN)).valueOf("argument"))){ - $ERROR('#6: (new Number(Number.NaN)).valueOf("argument") === NaN'); -} +assert.sameValue( + new Number(NaN).valueOf("argument"), + NaN, + "NaN" +); //CHECK#7 if((new Number(Number.POSITIVE_INFINITY)).valueOf("argument") !== Number.POSITIVE_INFINITY){ diff --git a/test/built-ins/Object/S9.9_A4.js b/test/built-ins/Object/S9.9_A4.js index 673b8900bc..a2a19160d9 100644 --- a/test/built-ins/Object/S9.9_A4.js +++ b/test/built-ins/Object/S9.9_A4.js @@ -132,9 +132,7 @@ if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype) } // CHECK#25 -if (isNaN(Object(Number.NaN).valueOf()) !== true){ - $ERROR('#25: Object(Number.NaN).valueOf() === Not-a-Number. Actual: ' + (Object(Number.NaN).valueOf())); -} +assert.sameValue(Object(NaN).valueOf(), NaN, "Object(NaN).valueOf()"); // CHECK#26 if (typeof Object(Number.NaN) !== "object"){ diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js index 53c841a934..0c89597d36 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js @@ -15,7 +15,7 @@ Object.defineProperty(obj, "foo", { value: NaN }); Object.defineProperty(obj, "foo", { value: NaN }); -assert(isNaN(obj.foo)); +assert.sameValue(obj.foo, NaN); verifyNotWritable(obj, "foo"); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js index 22192ade30..1c8a838100 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js @@ -24,7 +24,7 @@ Object.defineProperty(obj, "foo", { configurable: false }); -assert(isNaN(obj.foo)); +assert.sameValue(obj.foo, NaN); verifyNotWritable(obj, "foo"); diff --git a/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A2.js b/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A2.js index d34f9c58fd..67de5ee2e3 100644 --- a/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A2.js +++ b/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A2.js @@ -15,10 +15,4 @@ __FACTORY.prototype.charCodeAt = String.prototype.charCodeAt; var __instance = new __FACTORY; -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (!isNaN(__instance.charCodeAt(-1))) { - $ERROR('#1: function __FACTORY(){}; __FACTORY.prototype.charCodeAt = String.prototype.charCodeAt; __instance = new __FACTORY; isNaN(__instance.charCodeAt(-1)) return true. Actual: '+isNaN(__instance.charCodeAt(-1))); -} -// -////////////////////////////////////////////////////////////////////////////// +assert.sameValue(__instance.charCodeAt(-1), NaN); diff --git a/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A3.js b/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A3.js index 911fffa116..edb13b9f0d 100644 --- a/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A3.js +++ b/test/built-ins/String/prototype/charCodeAt/S15.5.4.5_A3.js @@ -11,10 +11,4 @@ description: pos is bigger of string length var __instance = new String("ABC"); -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (!isNaN(__instance.charCodeAt(3))) { - $ERROR('#1: __instance = new String("ABC"); isNaN(__instance.charCodeAt(3)) return true. Actual: '+isNaN(__instance.charCodeAt(3))); -} -// -////////////////////////////////////////////////////////////////////////////// +assert.sameValue(__instance.charCodeAt(3), NaN); diff --git a/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js b/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js index 884654a0b3..6f5dd52f76 100644 --- a/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js +++ b/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js @@ -23,8 +23,8 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample[0], 0, "#1 [0]"); assert.sameValue(sample[1], 1, "#1 [1]"); assert.sameValue(sample[2], 2, "#1 [2]"); - assert(Number.isNaN(sample[3]), "#1 [3]"); - assert(Number.isNaN(sample[4]), "#1 [4]"); + assert.sameValue(sample[3], NaN, "#1 [3]"); + assert.sameValue(sample[4], NaN, "#1 [4]"); sample = new TA([3, NaN, NaN, Infinity, 0, -Infinity, 2]).sort(); assert.sameValue(sample[0], -Infinity, "#2 [0]"); @@ -32,6 +32,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample[2], 2, "#2 [2]"); assert.sameValue(sample[3], 3, "#2 [3]"); assert.sameValue(sample[4], Infinity, "#2 [4]"); - assert(Number.isNaN(sample[5]), "#2 [5]"); - assert(Number.isNaN(sample[6]), "#2 [6]"); + assert.sameValue(sample[5], NaN, "#2 [5]"); + assert.sameValue(sample[6], NaN, "#2 [6]"); }, [Float64Array, Float32Array]); diff --git a/test/built-ins/parseFloat/15.1.2.3-2-1.js b/test/built-ins/parseFloat/15.1.2.3-2-1.js index ce12834c8f..db37bc3252 100644 --- a/test/built-ins/parseFloat/15.1.2.3-2-1.js +++ b/test/built-ins/parseFloat/15.1.2.3-2-1.js @@ -8,5 +8,4 @@ description: > does not contain any such characters ---*/ -assert(isNaN(parseFloat("")), 'isNaN(parseFloat("")) !== true'); assert.sameValue(parseFloat(""), NaN, 'parseFloat("")'); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A1_T1.js b/test/built-ins/parseFloat/S15.1.2.3_A1_T1.js index fc7ac7102e..78b0a673a0 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A1_T1.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A1_T1.js @@ -7,12 +7,5 @@ es5id: 15.1.2.3_A1_T1 description: Checking for boolean primitive ---*/ -//CHECK#1 -if (!(isNaN(parseFloat(true)) && isNaN(parseFloat("NaN")))) { - $ERROR('#1: parseFloat(true) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); -} - -//CHECK#2 -if (String(parseFloat(false)) !== "NaN") { - $ERROR('#2: String(parseFloat(false)) === "NaN". Actual: ' + (String(parseFloat(false)))); -} +assert.sameValue(parseFloat(true), NaN, "true"); +assert.sameValue(parseFloat(false), NaN, "false"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A1_T3.js b/test/built-ins/parseFloat/S15.1.2.3_A1_T3.js index 1a74bd1a91..fe461240fe 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A1_T3.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A1_T3.js @@ -7,23 +7,5 @@ es5id: 15.1.2.3_A1_T3 description: Checking for undefined and null ---*/ -//CHECK#1 -if (!(isNaN(parseFloat(undefined)) && isNaN(parseFloat("NaN")))) { - $ERROR('#1: parseFloat(undefined) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); -} - -//CHECK#2 -if (!(isNaN(parseFloat(null)) && isNaN(parseFloat("NaN")))) { - $ERROR('#2: parseFloat(null) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); -} - - -//CHECK#3 -if (String(parseFloat(undefined)) !== "NaN") { - $ERROR('#3: String(parseFloat(undefined)) === "NaN". Actual: ' + (String(parseFloat(undefined)))); -} - -//CHECK#4 -if (String(parseFloat(null)) !== "NaN") { - $ERROR('#4: String(parseFloat(null)) === "NaN". Actual: ' + (String(parseFloat(null)))); -} +assert.sameValue(parseFloat(undefined), NaN, "undefined"); +assert.sameValue(parseFloat(null), NaN, "null"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A1_T4.js b/test/built-ins/parseFloat/S15.1.2.3_A1_T4.js index c06b07070a..39f42382e3 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A1_T4.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A1_T4.js @@ -7,12 +7,5 @@ es5id: 15.1.2.3_A1_T4 description: Checking for Boolean object ---*/ -//CHECK#1 -if (!(isNaN(parseFloat(new Boolean(true))) && isNaN(parseFloat("NaN")))) { - $ERROR('#1: parseFloat(new Boolean(true)) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); -} - -//CHECK#2 -if (String(parseFloat(new Boolean(false))) !== "NaN") { - $ERROR('#2: String(parseFloat(new Boolean(false))) === "NaN". Actual: ' + (String(parseFloat(new Boolean(false))))); -} +assert.sameValue(parseFloat(new Boolean(true)), NaN, "new Boolean(true)"); +assert.sameValue(parseFloat(new Boolean(false)), NaN, "new Boolean(false)"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A1_T7.js b/test/built-ins/parseFloat/S15.1.2.3_A1_T7.js index 9cee05939f..06a1221bd2 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A1_T7.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A1_T7.js @@ -9,9 +9,7 @@ description: If Type(value) is Object, evaluate ToPrimitive(value, String) //CHECK#1 var object = {valueOf: function() {return 1}}; -if (isNaN(parseFloat(object)) !== true) { - $ERROR('#1: var object = {valueOf: function() {return 1}}; parseFloat(object) === Not-a-Number. Actual: ' + (parseFloat(object))); -} +assert.sameValue(parseFloat(object), NaN, "{valueOf: function() {return 1}}"); //CHECK#2 var object = {valueOf: function() {return 1}, toString: function() {return 0}}; diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T1.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T1.js index ef0038ba89..731e264607 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T1.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T1.js @@ -33,6 +33,4 @@ if (parseFloat(" \u0009 \u0009-1.1") !== parseFloat("-1.1")) { } //CHECK#6 -if (isNaN(parseFloat("\u0009")) !== true) { - $ERROR('#6: parseFloat("\\u0009") === Not-a-Number. Actual: ' + (parseFloat("\u0009"))); -} +assert.sameValue(parseFloat("\u0009"), NaN, "'\u0009'"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T10.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T10.js index 5ffac8f0b1..5b72b50bea 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T10.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T10.js @@ -8,12 +8,14 @@ description: "StrWhiteSpaceChar :: USP" ---*/ //CHECK# +var n; var count = 0; var errorCount = 0; var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"]; var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"]; for (var index = 0; index < uspU.length; index++) { var result = true; + n = false; if (parseFloat(uspU[index] + "1.1") !== parseFloat("1.1")) { $ERROR('#1.' + uspS[index] + ' '); result = false; @@ -22,7 +24,8 @@ for (var index = 0; index < uspU.length; index++) { $ERROR('#2.' + uspS[index] + ' '); result = false; } - if (isNaN(parseFloat(uspU[index])) !== true) { + n = parseFloat(uspU[index]); + if (!(n !== n)) { $ERROR('#3.' + uspS[index] + ' '); result = false; } diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T2.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T2.js index 2d39f4b532..abde61509a 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T2.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T2.js @@ -33,6 +33,4 @@ if (parseFloat(" \u0020 \u0020-1.1") !== parseFloat("-1.1")) { } //CHECK#6 -if (isNaN(parseFloat("\u0020")) !== true) { - $ERROR('#6: parseFloat("\\u0020") === Not-a-Number. Actual: ' + (parseFloat("\u0020"))); -} +assert.sameValue(parseFloat("\u0020"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T3.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T3.js index 4c325f6ac0..8d5c956c23 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T3.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T3.js @@ -18,6 +18,4 @@ if (parseFloat("\u00A0\u00A0-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u00A0")) !== true) { - $ERROR('#3: parseFloat("\\u00A0") === Not-a-Number. Actual: ' + (parseFloat("\u00A0"))); -} +assert.sameValue(parseFloat("\u00A0"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T4.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T4.js index 2e926fa06d..379621a3a8 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T4.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T4.js @@ -18,6 +18,4 @@ if (parseFloat("\u000C\u000C-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u000C")) !== true) { - $ERROR('#3: parseFloat("\\u000C") === Not-a-Number. Actual: ' + (parseFloat("\u000C"))); -} +assert.sameValue(parseFloat("\u000C"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T5.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T5.js index 5ee72d6eec..9ba570478a 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T5.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T5.js @@ -18,6 +18,4 @@ if (parseFloat("\u000B\u000B-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u000B")) !== true) { - $ERROR('#3: parseFloat("\\u000B") === Not-a-Number. Actual: ' + (parseFloat("\u000B"))); -} +assert.sameValue(parseFloat("\u000B"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T6.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T6.js index 269a7d3489..d9c66c77df 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T6.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T6.js @@ -18,6 +18,4 @@ if (parseFloat("\u000D\u000D-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u000D")) !== true) { - $ERROR('#3: parseFloat("\\u000D") === Not-a-Number. Actual: ' + (parseFloat("\u000D"))); -} +assert.sameValue(parseFloat("\u000D"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T7.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T7.js index 7646fbfbfe..8a4367df2d 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T7.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T7.js @@ -18,6 +18,4 @@ if (parseFloat("\u000A\u000A-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u000A")) !== true) { - $ERROR('#3: parseFloat("\\u000A") === Not-a-Number. Actual: ' + (parseFloat("\u000A"))); -} +assert.sameValue(parseFloat("\u000A"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T8.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T8.js index ebc7198d56..a9e9241186 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T8.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T8.js @@ -18,6 +18,4 @@ if (parseFloat("\u2028\u2028-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u2028")) !== true) { - $ERROR('#3: parseFloat("\\u2028") === Not-a-Number. Actual: ' + (parseFloat("\u2028"))); -} +assert.sameValue(parseFloat("\u2028"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A2_T9.js b/test/built-ins/parseFloat/S15.1.2.3_A2_T9.js index 9973b3f16b..a3d863c58b 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A2_T9.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A2_T9.js @@ -18,6 +18,4 @@ if (parseFloat("\u2029\u2029-1.1") !== parseFloat("-1.1")) { } //CHECK#3 -if (isNaN(parseFloat("\u2029")) !== true) { - $ERROR('#3: parseFloat("\\u2029") === Not-a-Number. Actual: ' + (parseFloat("\u2029"))); -} +assert.sameValue(parseFloat("\u2029"), NaN); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A3_T1.js b/test/built-ins/parseFloat/S15.1.2.3_A3_T1.js index 594af67c5d..99998f4222 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A3_T1.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A3_T1.js @@ -9,37 +9,7 @@ es5id: 15.1.2.3_A3_T1 description: parseFloat("some string") return NaN ---*/ -//CHECK#1 -if (isNaN(parseFloat("str")) !== true) { - $ERROR('#1: parseFloat("str") === Not-a-Number. Actual: ' + (parseFloat("str"))); -} - -//CHECK#2 -if (isNaN(parseFloat("s1")) !== true) { - $ERROR('#2: parseFloat("s1") === Not-a-Number. Actual: ' + (parseFloat("s1"))); -} - -//CHECK#3 -if (isNaN(parseFloat("")) !== true) { - $ERROR('#3: parseFloat("") === Not-a-Number. Actual: ' + (parseFloat(""))); -} - -//CHECK#4 -if (String(parseFloat("str")) !== "NaN") { - $ERROR('#4: String(parseFloat("str")) === "NaN". Actual: ' + (String(parseFloat("str")))); -} - -//CHECK#5 -if (String(parseFloat("s1")) !== "NaN") { - $ERROR('#5: String(parseFloat("s1")) === "NaN". Actual: ' + (String(parseFloat("s1")))); -} - -//CHECK#6 -if (String(parseFloat("")) !== "NaN") { - $ERROR('#6: String(parseFloat("")) === "NaN". Actual: ' + (String(parseFloat("")))); -} - -//CHECK#7 -if (String(parseFloat("+")) !== "NaN") { - $ERROR('#7: String(parseFloat("+")) === "NaN". Actual: ' + (String(parseFloat("+")))); -} +assert.sameValue(parseFloat("str"), NaN, "str"); +assert.sameValue(parseFloat("s1"), NaN, "s1"); +assert.sameValue(parseFloat(""), NaN, ""); +assert.sameValue(parseFloat("+"), NaN, "+"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A3_T2.js b/test/built-ins/parseFloat/S15.1.2.3_A3_T2.js index 4115548d18..47520f40c1 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A3_T2.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A3_T2.js @@ -9,52 +9,9 @@ es5id: 15.1.2.3_A3_T2 description: parseFloat("wrong number format with ExponentIndicator") return NaN ---*/ -//CHECK#1 -if (isNaN(parseFloat("e1")) !== true) { - $ERROR('#1: parseFloat("e1") === Not-a-Number. Actual: ' + (parseFloat("e1"))); -} - -//CHECK#2 -if (isNaN(parseFloat("e-1")) !== true) { - $ERROR('#2: parseFloat("e-1") === Not-a-Number. Actual: ' + (parseFloat("e-1"))); -} - -//CHECK#3 -if (isNaN(parseFloat("E+1")) !== true) { - $ERROR('#3: parseFloat("E+1") === Not-a-Number. Actual: ' + (parseFloat("E+1"))); -} - -//CHECK#4 -if (isNaN(parseFloat("E0")) !== true) { - $ERROR('#4: parseFloat("E0") === Not-a-Number. Actual: ' + (parseFloat("E0"))); -} - -//CHECK#5 -if (String(parseFloat("e1")) !== "NaN") { - $ERROR('#5: String(parseFloat("e1")) === "NaN". Actual: ' + (String(parseFloat("e1")))); -} - -//CHECK#6 -if (String(parseFloat("e-1")) !== "NaN") { - $ERROR('#6: String(parseFloat("e-1")) === "NaN". Actual: ' + (String(parseFloat("e-1")))); -} - -//CHECK#7 -if (String(parseFloat("E+1")) !== "NaN") { - $ERROR('#73: String(parseFloat("E+1")) === "NaN". Actual: ' + (String(parseFloat("E+1")))); -} - -//CHECK#8 -if (String(parseFloat("E0")) !== "NaN") { - $ERROR('#8: String(parseFloat("E0")) === "NaN". Actual: ' + (String(parseFloat("E0")))); -} - -//CHECK#9 -if (isNaN(parseFloat("-.e-1")) !== true) { - $ERROR('#9: parseFloat("-.e-1") === Not-a-Number. Actual: ' + (parseFloat("-.e-1"))); -} - -//CHECK#10 -if (isNaN(parseFloat(".e1")) !== true) { - $ERROR('#10: parseFloat(".e1") === Not-a-Number. Actual: ' + (parseFloat(".e1"))); -} +assert.sameValue(parseFloat("e1"), NaN, "e1"); +assert.sameValue(parseFloat("e-1"), NaN, "e-1"); +assert.sameValue(parseFloat("E+1"), NaN, "E+1"); +assert.sameValue(parseFloat("E0"), NaN, "E0"); +assert.sameValue(parseFloat("-.e-1"), NaN, "-.e-1"); +assert.sameValue(parseFloat(".e1"), NaN, ".e1"); diff --git a/test/built-ins/parseFloat/S15.1.2.3_A3_T3.js b/test/built-ins/parseFloat/S15.1.2.3_A3_T3.js index 667c5a8d63..632f4f407a 100644 --- a/test/built-ins/parseFloat/S15.1.2.3_A3_T3.js +++ b/test/built-ins/parseFloat/S15.1.2.3_A3_T3.js @@ -9,42 +9,7 @@ es5id: 15.1.2.3_A3_T3 description: parseFloat("wrong numbr format") return NaN ---*/ -//CHECK#1 -if (isNaN(parseFloat(".x")) !== true) { - $ERROR('#1: parseFloat(".x") === Not-a-Number. Actual: ' + (parseFloat(".x"))); -} - -//CHECK#2 -if (isNaN(parseFloat("+x")) !== true) { - $ERROR('#2: parseFloat("+x") === Not-a-Number. Actual: ' + (parseFloat("+x"))); -} - -//CHECK#3 -if (isNaN(parseFloat("infinity")) !== true) { - $ERROR('#3: parseFloat("infinity") === Not-a-Number. Actual: ' + (parseFloat("infinity"))); -} - -//CHECK#4 -if (isNaN(parseFloat("A")) !== true) { - $ERROR('#4: parseFloat("A") === Not-a-Number. Actual: ' + (parseFloat("A"))); -} - -//CHECK#5 -if (String(parseFloat(".s")) !== "NaN") { - $ERROR('#5: String(parseFloat(".s")) === "NaN". Actual: ' + (String(parseFloat(".s")))); -} - -//CHECK#6 -if (String(parseFloat("+x")) !== "NaN") { - $ERROR('#6: String(parseFloat("+x")) === "NaN". Actual: ' + (String(parseFloat("+x")))); -} - -//CHECK#7 -if (String(parseFloat("infinity")) !== "NaN") { - $ERROR('#73: String(parseFloat("infinity")) === "NaN". Actual: ' + (String(parseFloat("infinity")))); -} - -//CHECK#8 -if (String(parseFloat("A")) !== "NaN") { - $ERROR('#8: String(parseFloat("A")) === "NaN". Actual: ' + (String(parseFloat("A")))); -} +assert.sameValue(parseFloat(".x"), NaN, ".x"); +assert.sameValue(parseFloat("+x"), NaN, "+x"); +assert.sameValue(parseFloat("infinity"), NaN, "infinity"); +assert.sameValue(parseFloat("A"), NaN, "A"); diff --git a/test/built-ins/parseInt/15.1.2.2-2-1.js b/test/built-ins/parseInt/15.1.2.2-2-1.js index b87635ea9e..e896fca4cd 100644 --- a/test/built-ins/parseInt/15.1.2.2-2-1.js +++ b/test/built-ins/parseInt/15.1.2.2-2-1.js @@ -8,5 +8,4 @@ description: > contain any such characters ---*/ -assert(isNaN(parseInt("")), 'isNaN(parseInt("")) !== true'); assert.sameValue(parseInt(""), NaN, 'parseInt("")'); diff --git a/test/built-ins/parseInt/S15.1.2.2_A1_T1.js b/test/built-ins/parseInt/S15.1.2.2_A1_T1.js index d529674511..647f7ed102 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A1_T1.js +++ b/test/built-ins/parseInt/S15.1.2.2_A1_T1.js @@ -7,12 +7,5 @@ es5id: 15.1.2.2_A1_T1 description: Checking for boolean primitive ---*/ -//CHECK#1 -if (!(isNaN(parseInt(true)) && isNaN(parseInt("NaN")))) { - $ERROR('#1: parseInt(true) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); -} - -//CHECK#2 -if (String(parseInt(false)) !== "NaN") { - $ERROR('#2: String(parseInt(false)) === "NaN". Actual: ' + (String(parseInt(false)))); -} +assert.sameValue(parseInt(true), NaN, "true"); +assert.sameValue(parseInt(false), NaN, "false"); diff --git a/test/built-ins/parseInt/S15.1.2.2_A1_T3.js b/test/built-ins/parseInt/S15.1.2.2_A1_T3.js index d3669e503d..0d7e55e274 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A1_T3.js +++ b/test/built-ins/parseInt/S15.1.2.2_A1_T3.js @@ -7,22 +7,5 @@ es5id: 15.1.2.2_A1_T3 description: Checking for undefined and null ---*/ -//CHECK#1 -if (!(isNaN(parseInt(undefined)) && isNaN(parseInt("NaN")))) { - $ERROR('#1: parseInt(undefined) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); -} - -//CHECK#2 -if (!(isNaN(parseInt(null)) && isNaN(parseInt("NaN")))) { - $ERROR('#2: parseInt(null) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); -} - -//CHECK#3 -if (String(parseInt(undefined)) !== "NaN") { - $ERROR('#3: String(parseInt(undefined)) === "NaN". Actual: ' + (String(parseInt(undefined)))); -} - -//CHECK#4 -if (String(parseInt(null)) !== "NaN") { - $ERROR('#4: String(parseInt(null)) === "NaN". Actual: ' + (String(parseInt(null)))); -} +assert.sameValue(parseInt(undefined), NaN, "undefined"); +assert.sameValue(parseInt(null), NaN, "null"); diff --git a/test/built-ins/parseInt/S15.1.2.2_A1_T4.js b/test/built-ins/parseInt/S15.1.2.2_A1_T4.js index 0a54551ea0..550b14d5bd 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A1_T4.js +++ b/test/built-ins/parseInt/S15.1.2.2_A1_T4.js @@ -7,12 +7,5 @@ es5id: 15.1.2.2_A1_T4 description: Checking for Boolean object ---*/ -//CHECK#1 -if (!(isNaN(parseInt(new Boolean(true))) && isNaN(parseInt("NaN")))) { - $ERROR('#1: parseInt(new Boolean(true)) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); -} - -//CHECK#2 -if (String(parseInt(new Boolean(false))) !== "NaN") { - $ERROR('#2: String(parseInt(new Boolean(false))) === "NaN". Actual: ' + (String(parseInt(new Boolean(false))))); -} +assert.sameValue(parseInt(new Boolean(true)), NaN, "new Boolean(true)"); +assert.sameValue(parseInt(new Boolean(false)), NaN, "new Boolean(false)"); diff --git a/test/built-ins/parseInt/S15.1.2.2_A1_T7.js b/test/built-ins/parseInt/S15.1.2.2_A1_T7.js index 7b72549c0b..e0a60c87f8 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A1_T7.js +++ b/test/built-ins/parseInt/S15.1.2.2_A1_T7.js @@ -9,9 +9,7 @@ description: If Type(value) is Object, evaluate ToPrimitive(value, String) //CHECK#1 var object = {valueOf: function() {return 1}}; -if (isNaN(parseInt(object)) !== true) { - $ERROR('#1: var object = {valueOf: function() {return 1}}; parseInt(object) === Not-a-Number. Actual: ' + (parseInt(object))); -} +assert.sameValue(parseInt(object), NaN, "{valueOf: function() {return 1}}"); //CHECK#2 var object = {valueOf: function() {return 1}, toString: function() {return 0}}; diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T1.js b/test/built-ins/parseInt/S15.1.2.2_A2_T1.js index f7705d94bd..2b42ed5bb1 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T1.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T1.js @@ -33,6 +33,4 @@ if (parseInt(" \u0009 \u0009-1") !== parseInt("-1")) { } //CHECK#6 -if (isNaN(parseInt("\u0009")) !== true) { - $ERROR('#6: parseInt("\\u0009") === Not-a-Number. Actual: ' + (parseInt("\u0009"))); -} +assert.sameValue(parseInt("\u0009"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T10.js b/test/built-ins/parseInt/S15.1.2.2_A2_T10.js index cd678c1918..e23704e3be 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T10.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T10.js @@ -8,6 +8,7 @@ description: "StrWhiteSpaceChar :: USP" ---*/ //CHECK# +var n; var count = 0; var errorCount = 0; var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"]; @@ -15,6 +16,7 @@ var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "200 for (var index = 0; index < uspU.length; index++) { var result = true; + n = false; if (parseInt(uspU[index] + "1") !== parseInt("1")) { $ERROR('#1.' + uspS[index] + ' '); result = false; @@ -23,7 +25,8 @@ for (var index = 0; index < uspU.length; index++) { $ERROR('#2.' + uspS[index] + ' '); result = false; } - if (isNaN(parseInt(uspU[index])) !== true) { + n = parseInt(uspU[index]); + if (!(n !== n)) { $ERROR('#3.' + uspS[index] + ' '); result = false; } diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T2.js b/test/built-ins/parseInt/S15.1.2.2_A2_T2.js index 7e928a260f..5ffe23c152 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T2.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T2.js @@ -33,6 +33,4 @@ if (parseInt(" \u0020 \u0020-1") !== parseInt("-1")) { } //CHECK#6 -if (isNaN(parseInt("\u0020")) !== true) { - $ERROR('#6: parseInt("\\u0020") === Not-a-Number. Actual: ' + (parseInt("\u0020"))); -} +assert.sameValue(parseInt("\u0020"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T3.js b/test/built-ins/parseInt/S15.1.2.2_A2_T3.js index 8101371445..1ef28fbbf3 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T3.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T3.js @@ -18,6 +18,4 @@ if (parseInt("\u00A0\u00A0-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u00A0")) !== true) { - $ERROR('#3: parseInt("\\u00A0") === Not-a-Number. Actual: ' + (parseInt("\u00A0"))); -} +assert.sameValue(parseInt("\u00A0"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T4.js b/test/built-ins/parseInt/S15.1.2.2_A2_T4.js index 8f2503a876..9afef55d2c 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T4.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T4.js @@ -18,6 +18,4 @@ if (parseInt("\u000C\u000C-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u000C")) !== true) { - $ERROR('#3: parseInt("\\u000C") === Not-a-Number. Actual: ' + (parseInt("\u000C"))); -} +assert.sameValue(parseInt("\u000C"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T5.js b/test/built-ins/parseInt/S15.1.2.2_A2_T5.js index 3180d1d102..cc339390dd 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T5.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T5.js @@ -18,6 +18,4 @@ if (parseInt("\u000B\u000B-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u000B")) !== true) { - $ERROR('#3: parseInt("\\u000B") === Not-a-Number. Actual: ' + (parseInt("\u000B"))); -} +assert.sameValue(parseInt("\u000B"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T6.js b/test/built-ins/parseInt/S15.1.2.2_A2_T6.js index 1d21f55716..35d2a8683a 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T6.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T6.js @@ -18,6 +18,4 @@ if (parseInt("\u000D\u000D-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u000D")) !== true) { - $ERROR('#3: parseInt("\\u000D") === Not-a-Number. Actual: ' + (parseInt("\u000D"))); -} +assert.sameValue(parseInt("\u000D"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T7.js b/test/built-ins/parseInt/S15.1.2.2_A2_T7.js index c64781bc4b..447f1b4e85 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T7.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T7.js @@ -18,6 +18,4 @@ if (parseInt("\u000A\u000A-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u000A")) !== true) { - $ERROR('#3: parseInt("\\u000A") === Not-a-Number. Actual: ' + (parseInt("\u000A"))); -} +assert.sameValue(parseInt("\u000A"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T8.js b/test/built-ins/parseInt/S15.1.2.2_A2_T8.js index 4510648431..81757da32d 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T8.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T8.js @@ -18,6 +18,4 @@ if (parseInt("\u2028\u2028-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u2028")) !== true) { - $ERROR('#3: parseInt("\\u2028") === Not-a-Number. Actual: ' + (parseInt("\u2028"))); -} +assert.sameValue(parseInt("\u2028"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A2_T9.js b/test/built-ins/parseInt/S15.1.2.2_A2_T9.js index 7a332f7d3a..588d4c7a78 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A2_T9.js +++ b/test/built-ins/parseInt/S15.1.2.2_A2_T9.js @@ -18,6 +18,4 @@ if (parseInt("\u2029\u2029-1") !== parseInt("-1")) { } //CHECK#3 -if (isNaN(parseInt("\u2029")) !== true) { - $ERROR('#3: parseInt("\\u2029") === Not-a-Number. Actual: ' + (parseInt("\u2029"))); -} +assert.sameValue(parseInt("\u2029"), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A3.1_T1.js b/test/built-ins/parseInt/S15.1.2.2_A3.1_T1.js index be42ba08df..517681d82d 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A3.1_T1.js +++ b/test/built-ins/parseInt/S15.1.2.2_A3.1_T1.js @@ -13,6 +13,4 @@ if (parseInt("11", false) !== parseInt("11", 10)) { } //CHECK#2 -if (isNaN(parseInt("11", true)) !== true) { - $ERROR('#2: parseInt("11", true) === Not-a-Number. Actual: ' + (parseInt("11", true))); -} +assert.sameValue(parseInt("11", true), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A3.1_T4.js b/test/built-ins/parseInt/S15.1.2.2_A3.1_T4.js index 3dd4d1151f..c454aa55e5 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A3.1_T4.js +++ b/test/built-ins/parseInt/S15.1.2.2_A3.1_T4.js @@ -13,6 +13,4 @@ if (parseInt("11", new Boolean(false)) !== parseInt("11", false)) { } //CHECK#2 -if (isNaN(parseInt("11", new Boolean(true))) !== true) { - $ERROR('#2: parseInt("11", new Boolean(true)) === Not-a-Number. Actual: ' + (parseInt("11", new Boolean(true)))); -} +assert.sameValue(parseInt("11", new Boolean(true)), NaN); diff --git a/test/built-ins/parseInt/S15.1.2.2_A3.2_T3.js b/test/built-ins/parseInt/S15.1.2.2_A3.2_T3.js index 61118e5f79..8c7d162eb9 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A3.2_T3.js +++ b/test/built-ins/parseInt/S15.1.2.2_A3.2_T3.js @@ -18,9 +18,7 @@ if (parseInt("11", 4294967296) !== parseInt("11", 10)) { } //CHECK#3 -if (isNaN(parseInt("11", -2147483650)) !== true) { - $ERROR('#3: parseInt("11", 2147483650) === Not-a-Number. Actual: ' + (parseInt("11", 2147483650))); -} +assert.sameValue(parseInt("11", -2147483650), NaN, "-2147483650"); //CHECK#4 if (parseInt("11", -4294967294) !== parseInt("11", 2)) { diff --git a/test/built-ins/parseInt/S15.1.2.2_A4.2_T1.js b/test/built-ins/parseInt/S15.1.2.2_A4.2_T1.js index eabf0ada79..bde38d11b0 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A4.2_T1.js +++ b/test/built-ins/parseInt/S15.1.2.2_A4.2_T1.js @@ -7,62 +7,15 @@ es5id: 15.1.2.2_A4.2_T1 description: R = 1 ---*/ -//CHECK#0 -if (isNaN(parseInt("0", 1)) !== true) { - $ERROR('#0: parseInt("0", 1) === Not-a-Number. Actual: ' + (parseInt("0", 1))); -} - -//CHECK#1 -if (isNaN(parseInt("1", 1)) !== true) { - $ERROR('#1: parseInt("1", 1) === Not-a-Number. Actual: ' + (parseInt("1", 1))); -} - -//CHECK#2 -if (isNaN(parseInt("2", 1)) !== true) { - $ERROR('#2: parseInt("2", 1) === Not-a-Number. Actual: ' + (parseInt("2", 1))); -} - -//CHECK#3 -if (isNaN(parseInt("3", 1)) !== true) { - $ERROR('#3: parseInt("3", 1) === Not-a-Number. Actual: ' + (parseInt("3", 1))); -} - -//CHECK#4 -if (isNaN(parseInt("4", 1)) !== true) { - $ERROR('#4: parseInt("4", 1) === Not-a-Number. Actual: ' + (parseInt("4", 1))); -} - -//CHECK#5 -if (isNaN(parseInt("5", 1)) !== true) { - $ERROR('#5: parseInt("5", 1) === Not-a-Number. Actual: ' + (parseInt("5", 1))); -} - -//CHECK#6 -if (isNaN(parseInt("6", 1)) !== true) { - $ERROR('#6: parseInt("6", 1) === Not-a-Number. Actual: ' + (parseInt("6", 1))); -} - -//CHECK#7 -if (isNaN(parseInt("7", 1)) !== true) { - $ERROR('#7: parseInt("7", 1) === Not-a-Number. Actual: ' + (parseInt("7", 1))); -} - -//CHECK#8 -if (isNaN(parseInt("8", 1)) !== true) { - $ERROR('#8: parseInt("8", 1) === Not-a-Number. Actual: ' + (parseInt("8", 1))); -} - -//CHECK#9 -if (isNaN(parseInt("9", 1)) !== true) { - $ERROR('#9: parseInt("9", 1) === Not-a-Number. Actual: ' + (parseInt("9", 1))); -} - -//CHECK#10 -if (isNaN(parseInt("10", 1)) !== true) { - $ERROR('#10: parseInt("10", 1) === Not-a-Number. Actual: ' + (parseInt("10", 1))); -} - -//CHECK#11 -if (isNaN(parseInt("11", 1)) !== true) { - $ERROR('#11: parseInt("11", 1) === Not-a-Number. Actual: ' + (parseInt("11", 1))); -} +assert.sameValue(parseInt("0", 1), NaN, "0"); +assert.sameValue(parseInt("1", 1), NaN, "1"); +assert.sameValue(parseInt("2", 1), NaN, "2"); +assert.sameValue(parseInt("3", 1), NaN, "3"); +assert.sameValue(parseInt("4", 1), NaN, "4"); +assert.sameValue(parseInt("5", 1), NaN, "5"); +assert.sameValue(parseInt("6", 1), NaN, "6"); +assert.sameValue(parseInt("7", 1), NaN, "7"); +assert.sameValue(parseInt("8", 1), NaN, "8"); +assert.sameValue(parseInt("9", 1), NaN, "9"); +assert.sameValue(parseInt("10", 1), NaN, "10"); +assert.sameValue(parseInt("11", 1), NaN, "11"); diff --git a/test/built-ins/parseInt/S15.1.2.2_A4.2_T2.js b/test/built-ins/parseInt/S15.1.2.2_A4.2_T2.js index 2456c39d9d..d4e227ed90 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A4.2_T2.js +++ b/test/built-ins/parseInt/S15.1.2.2_A4.2_T2.js @@ -7,62 +7,15 @@ es5id: 15.1.2.2_A4.2_T2 description: R = 37 ---*/ -//CHECK#0 -if (isNaN(parseInt("0", 37)) !== true) { - $ERROR('#0: parseInt("0", 37) === Not-a-Number. Actual: ' + (parseInt("0", 37))); -} - -//CHECK#1 -if (isNaN(parseInt("1", 37)) !== true) { - $ERROR('#1: parseInt("1", 37) === Not-a-Number. Actual: ' + (parseInt("1", 37))); -} - -//CHECK#2 -if (isNaN(parseInt("2", 37)) !== true) { - $ERROR('#2: parseInt("2", 37) === Not-a-Number. Actual: ' + (parseInt("2", 37))); -} - -//CHECK#3 -if (isNaN(parseInt("3", 37)) !== true) { - $ERROR('#3: parseInt("3", 37) === Not-a-Number. Actual: ' + (parseInt("3", 37))); -} - -//CHECK#4 -if (isNaN(parseInt("4", 37)) !== true) { - $ERROR('#4: parseInt("4", 37) === Not-a-Number. Actual: ' + (parseInt("4", 37))); -} - -//CHECK#5 -if (isNaN(parseInt("5", 37)) !== true) { - $ERROR('#5: parseInt("5", 37) === Not-a-Number. Actual: ' + (parseInt("5", 37))); -} - -//CHECK#6 -if (isNaN(parseInt("6", 37)) !== true) { - $ERROR('#6: parseInt("6", 37) === Not-a-Number. Actual: ' + (parseInt("6", 37))); -} - -//CHECK#7 -if (isNaN(parseInt("7", 37)) !== true) { - $ERROR('#7: parseInt("7", 37) === Not-a-Number. Actual: ' + (parseInt("7", 37))); -} - -//CHECK#8 -if (isNaN(parseInt("8", 37)) !== true) { - $ERROR('#8: parseInt("8", 37) === Not-a-Number. Actual: ' + (parseInt("8", 37))); -} - -//CHECK#9 -if (isNaN(parseInt("9", 37)) !== true) { - $ERROR('#9: parseInt("9", 37) === Not-a-Number. Actual: ' + (parseInt("9", 37))); -} - -//CHECK#10 -if (isNaN(parseInt("10", 37)) !== true) { - $ERROR('#10: parseInt("10", 37) === Not-a-Number. Actual: ' + (parseInt("10", 37))); -} - -//CHECK#11 -if (isNaN(parseInt("11", 37)) !== true) { - $ERROR('#11: parseInt("11", 37) === Not-a-Number. Actual: ' + (parseInt("11", 37))); -} +assert.sameValue(parseInt("0", 37), NaN, "0"); +assert.sameValue(parseInt("1", 37), NaN, "1"); +assert.sameValue(parseInt("2", 37), NaN, "2"); +assert.sameValue(parseInt("3", 37), NaN, "3"); +assert.sameValue(parseInt("4", 37), NaN, "4"); +assert.sameValue(parseInt("5", 37), NaN, "5"); +assert.sameValue(parseInt("6", 37), NaN, "6"); +assert.sameValue(parseInt("7", 37), NaN, "7"); +assert.sameValue(parseInt("8", 37), NaN, "8"); +assert.sameValue(parseInt("9", 37), NaN, "9"); +assert.sameValue(parseInt("10", 37), NaN, "10"); +assert.sameValue(parseInt("11", 37), NaN, "11"); diff --git a/test/built-ins/parseInt/S15.1.2.2_A4.2_T3.js b/test/built-ins/parseInt/S15.1.2.2_A4.2_T3.js deleted file mode 100644 index 6982a69059..0000000000 --- a/test/built-ins/parseInt/S15.1.2.2_A4.2_T3.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: If R < 2 or R > 36, then return NaN -es5id: 15.1.2.2_A4.2_T3 -description: Complex test ----*/ - -//CHECK# -var pow = 2; -for (var i = 1; i < 32; i++) { - if (pow > 36) { - var res = true; - if (isNaN(parseInt(1, pow)) !== true) { - $ERROR('#1.' + i + ': If R < 2 or R > 36, then return NaN'); - } - if (isNaN(parseInt(1, -pow)) !== true) { - $ERROR('#2.' + i + ': If R < 2 or R > 36, then return NaN'); - } - } - pow = pow * 2; -} diff --git a/test/built-ins/parseInt/S15.1.2.2_A7.1_T1.js b/test/built-ins/parseInt/S15.1.2.2_A7.1_T1.js index d14000321a..bacf290fe7 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A7.1_T1.js +++ b/test/built-ins/parseInt/S15.1.2.2_A7.1_T1.js @@ -9,7 +9,5 @@ description: Complex test. R in [2, 36] //CHECK# for (var i = 2; i <= 36; i++) { - if (isNaN(parseInt("$string", i)) !== true) { - $ERROR('#' + i + ': parseInt("$string", i) === Not-a-Number. Actual: ' + (parseInt("$string", i))); - } + assert.sameValue(parseInt("$string", i), NaN); } diff --git a/test/built-ins/parseInt/S15.1.2.2_A7.1_T2.js b/test/built-ins/parseInt/S15.1.2.2_A7.1_T2.js index fa89df158e..82d9d7e7bd 100644 --- a/test/built-ins/parseInt/S15.1.2.2_A7.1_T2.js +++ b/test/built-ins/parseInt/S15.1.2.2_A7.1_T2.js @@ -7,27 +7,8 @@ es5id: 15.1.2.2_A7.1_T2 description: x is not a radix-R digit ---*/ -//CHECK#1 -if (isNaN(parseInt("$0x")) !== true) { - $ERROR('#1: parseInt("$0x") === Not-a-Number. Actual: ' + (parseInt("$0x"))); -} - -//CHECK#2 -if (isNaN(parseInt("$0X")) !== true) { - $ERROR('#2: parseInt("$0X") === Not-a-Number. Actual: ' + (parseInt("$0X"))); -} - -//CHECK#3 -if (isNaN(parseInt("$$$")) !== true) { - $ERROR('#3: parseInt("$$$") === Not-a-Number. Actual: ' + (parseInt("$$$"))); -} - -//CHECK#4 -if (isNaN(parseInt("")) !== true) { - $ERROR('#4: parseInt("") === Not-a-Number. Actual: ' + (parseInt(""))); -} - -//CHECK#5 -if (isNaN(parseInt(" ")) !== true) { - $ERROR('#5: parseInt(" ") === Not-a-Number. Actual: ' + (parseInt(" "))); -} +assert.sameValue(parseInt("$0x"), NaN, "$0x"); +assert.sameValue(parseInt("$0X"), NaN, "$0X"); +assert.sameValue(parseInt("$$$"), NaN, "$$$"); +assert.sameValue(parseInt(""), NaN, "the empty string"); +assert.sameValue(parseInt(" "), NaN, "a string with a single space"); diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js index 7b0a327446..02e2049cdf 100644 --- a/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A1.js @@ -20,7 +20,9 @@ bases[8] = NaN; for (var i = 0; i < bases.length; i++) { - if (!isNaN(bases[i] ** exponent)) { - $ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false"); - } + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); } diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js index 2e36861c2f..c2010f3ee3 100644 --- a/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A23.js @@ -25,9 +25,11 @@ exponents[7] = Math.PI; for (var i = 0; i < bases.length; i++) { for (var j = 0; j < exponents.length; j++) { - if (!isNaN(bases[i] ** exponents[j])) { - $ERROR("isNaN(" + bases[i] + " ** " + exponents[j] + ") === false"); - } + assert.sameValue( + bases[i] ** exponents[j], + NaN, + bases[i] + " ** " + exponents[j] + ); } } diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js index f9178e29fa..f7af999322 100644 --- a/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A4.js @@ -18,7 +18,9 @@ exponents[5] = +Infinity; exponents[6] = NaN; for (var i = 0; i < exponents.length; i++) { - if (!isNaN(base ** exponents[i])) { - $ERROR("isNaN(" + base + " ** " + exponents[i] + ") === false"); - } + assert.sameValue( + base ** exponents[i], + NaN, + base + " ** " + exponents[i] + ); } diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js index e5ea4c7398..5420f64f89 100644 --- a/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A7.js @@ -13,7 +13,9 @@ bases[0] = -1; bases[1] = 1 for (var i = 0; i < bases.length; i++) { - if (!isNaN(bases[i] ** exponent)) { - $ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false"); - } + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); } diff --git a/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js b/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js index a240643798..0e3dcc3679 100644 --- a/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js +++ b/test/language/expressions/exponentiation/applying-the-exp-operator_A8.js @@ -13,7 +13,9 @@ bases[0] = -1; bases[1] = 1 for (var i = 0; i < bases.length; i++) { - if (!isNaN(bases[i] ** exponent)) { - $ERROR("isNaN(" + bases[i] + " ** " + exponent + ") === false"); - } + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); } diff --git a/test/language/statements/throw/S12.13_A2_T5.js b/test/language/statements/throw/S12.13_A2_T5.js index f6736794cb..782bf16054 100644 --- a/test/language/statements/throw/S12.13_A2_T5.js +++ b/test/language/statements/throw/S12.13_A2_T5.js @@ -39,7 +39,7 @@ try{ throw NaN; } catch(e){ - if (!isNaN(e)) $ERROR('#4: Exception is NaN'); + assert.sameValue(e, NaN, "e is NaN"); } // CHECK#5 diff --git a/test/language/statements/try/S12.14_A18_T5.js b/test/language/statements/try/S12.14_A18_T5.js index c22ced99e1..13a92ab507 100644 --- a/test/language/statements/try/S12.14_A18_T5.js +++ b/test/language/statements/try/S12.14_A18_T5.js @@ -64,7 +64,7 @@ try{ throw NaN; } catch(e){ - if (!isNaN(e)) $ERROR('#7: Exception is NaN'); + assert.sameValue(e, NaN, "e is NaN"); } // CHECK#8 diff --git a/test/language/statements/with/S12.10_A1.11_T1.js b/test/language/statements/with/S12.10_A1.11_T1.js index dd5c3541bc..43ee0c775e 100644 --- a/test/language/statements/with/S12.10_A1.11_T1.js +++ b/test/language/statements/with/S12.10_A1.11_T1.js @@ -113,9 +113,7 @@ if(!(st_parseInt === parseInt)){ $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); } -if(!isNaN(st_NaN)){ - $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); -} +assert.sameValue(st_NaN, NaN, "st_NaN is NaN"); if(!(st_Infinity === Infinity)){ $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); diff --git a/test/language/statements/with/S12.10_A1.11_T2.js b/test/language/statements/with/S12.10_A1.11_T2.js index 3ad8c7185e..823f894987 100644 --- a/test/language/statements/with/S12.10_A1.11_T2.js +++ b/test/language/statements/with/S12.10_A1.11_T2.js @@ -118,9 +118,7 @@ if(!(st_parseInt === parseInt)){ $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); } -if(!isNaN(st_NaN)){ - $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); -} +assert.sameValue(st_NaN, NaN, "st_NaN is NaN"); if(!(st_Infinity === Infinity)){ $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); diff --git a/test/language/statements/with/S12.10_A1.11_T4.js b/test/language/statements/with/S12.10_A1.11_T4.js index 368a781fa3..d44954f9b6 100644 --- a/test/language/statements/with/S12.10_A1.11_T4.js +++ b/test/language/statements/with/S12.10_A1.11_T4.js @@ -121,9 +121,7 @@ if(!(st_parseInt === parseInt)){ $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); } -if(!isNaN(st_NaN)){ - $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); -} +assert.sameValue(st_NaN, NaN, 'st_NaN is NaN'); if(!(st_Infinity === Infinity)){ $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); diff --git a/test/language/types/object/S8.6_A2_T1.js b/test/language/types/object/S8.6_A2_T1.js index c9f209cce8..af6e0ee290 100644 --- a/test/language/types/object/S8.6_A2_T1.js +++ b/test/language/types/object/S8.6_A2_T1.js @@ -13,9 +13,7 @@ var __map={foo:"bar"}; //CHECK#1 __map.foo++; -if (!isNaN(__map.foo)) { - $ERROR('#1: var __map={foo:"bar"}; __map.foo++; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); -} +assert.sameValue(__map.foo, NaN); // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6_A2_T2.js b/test/language/types/object/S8.6_A2_T2.js index 06976ab7ed..28984e4efa 100644 --- a/test/language/types/object/S8.6_A2_T2.js +++ b/test/language/types/object/S8.6_A2_T2.js @@ -11,9 +11,7 @@ var __map={}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 -if (!isNaN(__map.foo++)) { - $ERROR('#1: var __map={}; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); -} +assert.sameValue(__map.foo++, NaN); // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6_A3_T1.js b/test/language/types/object/S8.6_A3_T1.js index 3412fce325..dc06cd8537 100644 --- a/test/language/types/object/S8.6_A3_T1.js +++ b/test/language/types/object/S8.6_A3_T1.js @@ -13,9 +13,6 @@ var __map={foo:'bar'}; //CHECK#1 ++__map.foo; -if (!isNaN(__map.foo)) { - $ERROR('#1: var __map={foo:"bar"}; ++__map.foo; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); -} - +assert.sameValue(__map.foo, NaN); // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/language/types/object/S8.6_A3_T2.js b/test/language/types/object/S8.6_A3_T2.js index f57c37dc34..7e495c64af 100644 --- a/test/language/types/object/S8.6_A3_T2.js +++ b/test/language/types/object/S8.6_A3_T2.js @@ -11,9 +11,7 @@ var __map={}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 -if (!isNaN(++__map.foo)) { - $ERROR('#1: var __map={}; __map.foo++; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); -} +assert.sameValue(++__map.foo, NaN, "++__map.foo"); // //////////////////////////////////////////////////////////////////////////////