js/src/tests/ecma/Expressions/11.8.3.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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.3.js
michael@0 9 ECMA Section: 11.8.3 The less-than-or-equal operator ( <= )
michael@0 10 Description:
michael@0 11
michael@0 12 Author: christine@netscape.com
michael@0 13 Date: 12 november 1997
michael@0 14 */
michael@0 15 var SECTION = "11.8.1";
michael@0 16 var VERSION = "ECMA_1";
michael@0 17 startTest();
michael@0 18
michael@0 19 writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )");
michael@0 20
michael@0 21 new TestCase( SECTION, "true <= false", false, true <= false );
michael@0 22 new TestCase( SECTION, "false <= true", true, false <= true );
michael@0 23 new TestCase( SECTION, "false <= false", true, false <= false );
michael@0 24 new TestCase( SECTION, "true <= true", true, true <= true );
michael@0 25
michael@0 26 new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) );
michael@0 27 new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) );
michael@0 28 new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) );
michael@0 29 new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) );
michael@0 30
michael@0 31 new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
michael@0 32 new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_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.NEGATIVE_INFINITY) );
michael@0 34
michael@0 35 new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) );
michael@0 36 new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) );
michael@0 37 new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) );
michael@0 38
michael@0 39 new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) );
michael@0 40 new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) );
michael@0 41 new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) );
michael@0 42
michael@0 43 new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN );
michael@0 44 new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN );
michael@0 45 new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 );
michael@0 46
michael@0 47 new TestCase( SECTION, "0 <= -0", true, 0 <= -0 );
michael@0 48 new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 );
michael@0 49
michael@0 50 new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 );
michael@0 51 new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE );
michael@0 52 new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY );
michael@0 53
michael@0 54 new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY );
michael@0 55 new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY );
michael@0 56
michael@0 57 new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY );
michael@0 58 new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY );
michael@0 59 new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY );
michael@0 60
michael@0 61 new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 );
michael@0 62 new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE );
michael@0 63 new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE );
michael@0 64
michael@0 65 new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' );
michael@0 66 new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' );
michael@0 67 new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' );
michael@0 68 new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' );
michael@0 69 new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' );
michael@0 70 new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' );
michael@0 71
michael@0 72 test();
michael@0 73
michael@0 74 function MyObject(value) {
michael@0 75 this.value = value;
michael@0 76 this.valueOf = new Function( "return this.value" );
michael@0 77 this.toString = new Function( "return this.value +''" );
michael@0 78 }
michael@0 79 function MyValueObject(value) {
michael@0 80 this.value = value;
michael@0 81 this.valueOf = new Function( "return this.value" );
michael@0 82 }
michael@0 83 function MyStringObject(value) {
michael@0 84 this.value = value;
michael@0 85 this.toString = new Function( "return this.value +''" );
michael@0 86 }

mercurial