michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: var list = [ michael@0: [1, 1, true], michael@0: [0, 1, false], michael@0: [3.5, 3.5, true], michael@0: [0, 0, true], michael@0: [0, -0, false], michael@0: [-0, 0, false], michael@0: [-0, -0, true], michael@0: michael@0: [true, true, true], michael@0: [true, false, false], michael@0: [false, false, true], michael@0: michael@0: [NaN, NaN, true], michael@0: [NaN, undefined, false], michael@0: [Infinity, -Infinity, false], michael@0: [Infinity, Infinity, true], michael@0: ] michael@0: michael@0: for (var test of list) { michael@0: assertEq(Object.is(test[0], test[1]), test[2]) michael@0: } michael@0: michael@0: var obj = {} michael@0: assertEq(Object.is(obj, obj), true); michael@0: assertEq(Object.is(obj, {}), false); michael@0: assertEq(Object.is([], []), false); michael@0: michael@0: assertEq(Object.is(null, null, null), true); michael@0: michael@0: /* Not defined parameters are undefined ... */ michael@0: assertEq(Object.is(null), false); michael@0: assertEq(Object.is(undefined), true); michael@0: assertEq(Object.is(), true); michael@0: michael@0: assertEq(Object.is.length, 2);