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.4.9.js michael@0: ECMA Section: 11.4.9 Logical NOT Operator (!) michael@0: Description: if the ToBoolean( VALUE ) result is true, return michael@0: true. else return false. michael@0: Author: christine@netscape.com michael@0: Date: 7 july 1997 michael@0: michael@0: Static variables: michael@0: none michael@0: */ michael@0: var SECTION = "11.4.9"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "Logical NOT operator (!)"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, "!(null)", true, !(null) ); michael@0: new TestCase( SECTION, "!(var x)", true, !(eval("var x")) ); michael@0: new TestCase( SECTION, "!(void 0)", true, !(void 0) ); michael@0: michael@0: new TestCase( SECTION, "!(false)", true, !(false) ); michael@0: new TestCase( SECTION, "!(true)", false, !(true) ); michael@0: new TestCase( SECTION, "!()", true, !(eval()) ); michael@0: new TestCase( SECTION, "!(0)", true, !(0) ); michael@0: new TestCase( SECTION, "!(-0)", true, !(-0) ); michael@0: new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) ); michael@0: new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) ); michael@0: new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) ); michael@0: new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) ); michael@0: new TestCase( SECTION, "!(1)", false, !(1) ); michael@0: new TestCase( SECTION, "!(-1)", false, !(-1) ); michael@0: new TestCase( SECTION, "!('')", true, !("") ); michael@0: new TestCase( SECTION, "!('\t')", false, !("\t") ); michael@0: new TestCase( SECTION, "!('0')", false, !("0") ); michael@0: new TestCase( SECTION, "!('string')", false, !("string") ); michael@0: new TestCase( SECTION, "!(new String(''))", false, !(new String("")) ); michael@0: new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) ); michael@0: new TestCase( SECTION, "!(new String())", false, !(new String()) ); michael@0: new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) ); michael@0: new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) ); michael@0: new TestCase( SECTION, "!(new Array())", false, !(new Array()) ); michael@0: new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) ); michael@0: new TestCase( SECTION, "!(new Number())", false, !(new Number()) ); michael@0: new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) ); michael@0: new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) ); michael@0: new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) ); michael@0: michael@0: test(); michael@0: