From f7b78d0c43dfd210f120ecc88f3a0d0abc893c32 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Wed, 30 Jan 2013 00:26:17 +0200 Subject: [PATCH] test case for less-than comparison details --- testcases/test-dev-compare-lt.js | 154 +++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 testcases/test-dev-compare-lt.js diff --git a/testcases/test-dev-compare-lt.js b/testcases/test-dev-compare-lt.js new file mode 100644 index 00000000..92b1526a --- /dev/null +++ b/testcases/test-dev-compare-lt.js @@ -0,0 +1,154 @@ +/* + * Tests for E5 Section 11.8.5. + */ + +function f(x,y) { + print(x < y); +} + +/*=== +===*/ + +/* String cases. */ + +/* FIXME */ + +/*=== +false +false +false +false +false +false +false +false +false +false +false +false +false +===*/ + +/* Numeric cases involving NaN (steps c and d) */ + +f(NaN, Number.NEGATIVE_INFINITY); +f(NaN, -1); +f(NaN, -0); +f(NaN, +0); +f(NaN, 1); +f(NaN, Number.POSITIVE_INFINITY); + +f(Number.NEGATIVE_INFINITY, NaN); +f(-1, NaN); +f(-0, NaN); +f(+0, NaN); +f(1, NaN); +f(Number.POSITIVE_INFINITY, NaN); + +f(NaN, NaN); + +/*=== +false +false +false +false +false +false +===*/ + +/* Cases involving same number value (step e) */ + +f(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); +f(-1, -1); +f(-0, -0); +f(+0, +0); +f(1, 1); +f(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY); + +/*=== +false +false +false +false +===*/ + +/* Zeroes always compare to false: same sign cases are matched by step e, + * different sign cases by steps f and g. + */ + +f(-0, -0); +f(-0, +0); +f(+0, -0); +f(+0, +0); + +/*=== +false +false +false +false +false +false +true +true +true +true +true +false +false +false +false +false +false +false +false +true +true +true +true +true +===*/ + +/* Infinity cases */ + +// step h +f(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY); +f(Number.POSITIVE_INFINITY, -1); +f(Number.POSITIVE_INFINITY, -0); +f(Number.POSITIVE_INFINITY, +0); +f(Number.POSITIVE_INFINITY, 1); +f(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY); // actually covered by step e -> false + +// step i +f(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY); +f(-1, Number.POSITIVE_INFINITY); +f(-0, Number.POSITIVE_INFINITY); +f(+0, Number.POSITIVE_INFINITY); +f(1, Number.POSITIVE_INFINITY); +f(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY); // actually covered by step e -> false + +// step j +f(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); // actually covered by step e -> false +f(-1, Number.NEGATIVE_INFINITY); +f(-0, Number.NEGATIVE_INFINITY); +f(+0, Number.NEGATIVE_INFINITY); +f(1, Number.NEGATIVE_INFINITY); +f(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY); + +// step k +f(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); // actually covered by step e -> false +f(Number.NEGATIVE_INFINITY, -1); +f(Number.NEGATIVE_INFINITY, -0); +f(Number.NEGATIVE_INFINITY, +0); +f(Number.NEGATIVE_INFINITY, 1); +f(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY); + +/*=== +true +false +===*/ + +/* Normal number cases */ + +f(-1, 1); +f(1, -1); +