Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 11.8.1.js |
michael@0 | 9 | ECMA Section: 11.8.1 The less-than operator ( < ) |
michael@0 | 10 | Description: |
michael@0 | 11 | |
michael@0 | 12 | |
michael@0 | 13 | Author: christine@netscape.com |
michael@0 | 14 | Date: 12 november 1997 |
michael@0 | 15 | */ |
michael@0 | 16 | var SECTION = "11.8.1"; |
michael@0 | 17 | var VERSION = "ECMA_1"; |
michael@0 | 18 | startTest(); |
michael@0 | 19 | |
michael@0 | 20 | writeHeaderToLog( SECTION + " The less-than operator ( < )"); |
michael@0 | 21 | |
michael@0 | 22 | new TestCase( SECTION, "true < false", false, true < false ); |
michael@0 | 23 | new TestCase( SECTION, "false < true", true, false < true ); |
michael@0 | 24 | new TestCase( SECTION, "false < false", false, false < false ); |
michael@0 | 25 | new TestCase( SECTION, "true < true", false, true < true ); |
michael@0 | 26 | |
michael@0 | 27 | new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) ); |
michael@0 | 28 | new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) ); |
michael@0 | 29 | new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) ); |
michael@0 | 30 | new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) ); |
michael@0 | 31 | |
michael@0 | 32 | new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); |
michael@0 | 33 | new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); |
michael@0 | 34 | new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) ); |
michael@0 | 35 | |
michael@0 | 36 | new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) ); |
michael@0 | 37 | new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) ); |
michael@0 | 38 | new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) ); |
michael@0 | 39 | |
michael@0 | 40 | new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) ); |
michael@0 | 41 | new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) ); |
michael@0 | 42 | new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) ); |
michael@0 | 43 | |
michael@0 | 44 | new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN ); |
michael@0 | 45 | new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN ); |
michael@0 | 46 | new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 ); |
michael@0 | 47 | |
michael@0 | 48 | new TestCase( SECTION, "0 < -0", false, 0 < -0 ); |
michael@0 | 49 | new TestCase( SECTION, "-0 < 0", false, -0 < 0 ); |
michael@0 | 50 | |
michael@0 | 51 | new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 ); |
michael@0 | 52 | new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE ); |
michael@0 | 53 | new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY ); |
michael@0 | 54 | |
michael@0 | 55 | new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY ); |
michael@0 | 56 | new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY ); |
michael@0 | 57 | |
michael@0 | 58 | new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY ); |
michael@0 | 59 | new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY ); |
michael@0 | 60 | new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY ); |
michael@0 | 61 | |
michael@0 | 62 | new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 ); |
michael@0 | 63 | new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE ); |
michael@0 | 64 | new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE ); |
michael@0 | 65 | |
michael@0 | 66 | new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' ); |
michael@0 | 67 | new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' ); |
michael@0 | 68 | new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' ); |
michael@0 | 69 | new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' ); |
michael@0 | 70 | new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' ); |
michael@0 | 71 | new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' ); |
michael@0 | 72 | |
michael@0 | 73 | test(); |
michael@0 | 74 | |
michael@0 | 75 | function MyObject(value) { |
michael@0 | 76 | this.value = value; |
michael@0 | 77 | this.valueOf = new Function( "return this.value" ); |
michael@0 | 78 | this.toString = new Function( "return this.value +''" ); |
michael@0 | 79 | } |
michael@0 | 80 | function MyValueObject(value) { |
michael@0 | 81 | this.value = value; |
michael@0 | 82 | this.valueOf = new Function( "return this.value" ); |
michael@0 | 83 | } |
michael@0 | 84 | function MyStringObject(value) { |
michael@0 | 85 | this.value = value; |
michael@0 | 86 | this.toString = new Function( "return this.value +''" ); |
michael@0 | 87 | } |