michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 11.8.1.js michael@0: ECMA Section: 11.8.1 The less-than operator ( < ) michael@0: Description: michael@0: michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 12 november 1997 michael@0: */ michael@0: var SECTION = "11.8.1"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: michael@0: writeHeaderToLog( SECTION + " The less-than operator ( < )"); michael@0: michael@0: new TestCase( SECTION, "true < false", false, true < false ); michael@0: new TestCase( SECTION, "false < true", true, false < true ); michael@0: new TestCase( SECTION, "false < false", false, false < false ); michael@0: new TestCase( SECTION, "true < true", false, true < true ); michael@0: michael@0: new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) ); michael@0: new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) ); michael@0: new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) ); michael@0: new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) ); michael@0: michael@0: new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); michael@0: new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); michael@0: new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) ); michael@0: new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) ); michael@0: new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) ); michael@0: michael@0: new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) ); michael@0: new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) ); michael@0: new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) ); michael@0: michael@0: new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN ); michael@0: new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN ); michael@0: new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 ); michael@0: michael@0: new TestCase( SECTION, "0 < -0", false, 0 < -0 ); michael@0: new TestCase( SECTION, "-0 < 0", false, -0 < 0 ); michael@0: michael@0: new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 ); michael@0: new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE ); michael@0: new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY ); michael@0: michael@0: new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY ); michael@0: new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY ); michael@0: michael@0: new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY ); michael@0: new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY ); michael@0: new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY ); michael@0: michael@0: new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 ); michael@0: new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE ); michael@0: new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE ); michael@0: michael@0: new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' ); michael@0: new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' ); michael@0: new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' ); michael@0: new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' ); michael@0: new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' ); michael@0: new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' ); michael@0: michael@0: test(); michael@0: michael@0: function MyObject(value) { michael@0: this.value = value; michael@0: this.valueOf = new Function( "return this.value" ); michael@0: this.toString = new Function( "return this.value +''" ); michael@0: } michael@0: function MyValueObject(value) { michael@0: this.value = value; michael@0: this.valueOf = new Function( "return this.value" ); michael@0: } michael@0: function MyStringObject(value) { michael@0: this.value = value; michael@0: this.toString = new Function( "return this.value +''" ); michael@0: }