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: 7.6.js michael@0: ECMA Section: Punctuators michael@0: Description: michael@0: michael@0: This tests verifies that all ECMA punctutors are recognized as a michael@0: token separator, but does not attempt to verify the functionality michael@0: of any punctuator. michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 12 november 1997 michael@0: */ michael@0: michael@0: var SECTION = "7.6"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "Punctuators"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: // == michael@0: new TestCase( SECTION, michael@0: "var c,d;c==d", michael@0: true, michael@0: eval("var c,d;c==d") ); michael@0: michael@0: // = michael@0: michael@0: new TestCase( SECTION, michael@0: "var a=true;a", michael@0: true, michael@0: eval("var a=true;a") ); michael@0: michael@0: // > michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false;a>b", michael@0: true, michael@0: eval("var a=true,b=false;a>b") ); michael@0: michael@0: // < michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false;a= michael@0: new TestCase( SECTION, michael@0: "var a=0xFFFF,b=0XFFFE;a>=b", michael@0: true, michael@0: eval("var a=0xFFFF,b=0XFFFE;a>=b") ); michael@0: michael@0: // != michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false;a!=b", michael@0: true, michael@0: eval("var a=true,b=false;a!=b") ); michael@0: michael@0: new TestCase( SECTION, michael@0: "var a=false,b=false;a!=b", michael@0: false, michael@0: eval("var a=false,b=false;a!=b") ); michael@0: // , michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false;a,b", michael@0: false, michael@0: eval("var a=true,b=false;a,b") ); michael@0: // ! michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false;!a", michael@0: false, michael@0: eval("var a=true,b=false;!a") ); michael@0: michael@0: // ~ michael@0: new TestCase( SECTION, michael@0: "var a=true;~a", michael@0: -2, michael@0: eval("var a=true;~a") ); michael@0: // ? michael@0: new TestCase( SECTION, michael@0: "var a=true; (a ? 'PASS' : '')", michael@0: "PASS", michael@0: eval("var a=true; (a ? 'PASS' : '')") ); michael@0: michael@0: // : michael@0: michael@0: new TestCase( SECTION, michael@0: "var a=false; (a ? 'FAIL' : 'PASS')", michael@0: "PASS", michael@0: eval("var a=false; (a ? 'FAIL' : 'PASS')") ); michael@0: // . michael@0: michael@0: new TestCase( SECTION, michael@0: "var a=Number;a.NaN", michael@0: NaN, michael@0: eval("var a=Number;a.NaN") ); michael@0: michael@0: // && michael@0: new TestCase( SECTION, michael@0: "var a=true,b=true;if(a&&b)'PASS';else'FAIL'", michael@0: "PASS", michael@0: eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") ); michael@0: michael@0: // || michael@0: new TestCase( SECTION, michael@0: "var a=false,b=false;if(a||b)'FAIL';else'PASS'", michael@0: "PASS", michael@0: eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") ); michael@0: // ++ michael@0: new TestCase( SECTION, michael@0: "var a=false,b=false;++a", michael@0: 1, michael@0: eval("var a=false,b=false;++a") ); michael@0: // -- michael@0: new TestCase( SECTION, michael@0: "var a=true,b=false--a", michael@0: 0, michael@0: eval("var a=true,b=false;--a") ); michael@0: // + michael@0: michael@0: new TestCase( SECTION, michael@0: "var a=true,b=true;a+b", michael@0: 2, michael@0: eval("var a=true,b=true;a+b") ); michael@0: // - michael@0: new TestCase( SECTION, michael@0: "var a=true,b=true;a-b", michael@0: 0, michael@0: eval("var a=true,b=true;a-b") ); michael@0: // * michael@0: new TestCase( SECTION, michael@0: "var a=true,b=true;a*b", michael@0: 1, michael@0: eval("var a=true,b=true;a*b") ); michael@0: // / michael@0: new TestCase( SECTION, michael@0: "var a=true,b=true;a/b", michael@0: 1, michael@0: eval("var a=true,b=true;a/b") ); michael@0: // & michael@0: new TestCase( SECTION, michael@0: "var a=3,b=2;a&b", michael@0: 2, michael@0: eval("var a=3,b=2;a&b") ); michael@0: // | michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a|b", michael@0: 7, michael@0: eval("var a=4,b=3;a|b") ); michael@0: michael@0: // | michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a^b", michael@0: 7, michael@0: eval("var a=4,b=3;a^b") ); michael@0: michael@0: // % michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a|b", michael@0: 1, michael@0: eval("var a=4,b=3;a%b") ); michael@0: michael@0: // << michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a<> michael@0: new TestCase( SECTION, michael@0: "var a=4,b=1;a>>b", michael@0: 2, michael@0: eval("var a=4,b=1;a>>b") ); michael@0: michael@0: // >>> michael@0: new TestCase( SECTION, michael@0: "var a=1,b=1;a>>>b", michael@0: 0, michael@0: eval("var a=1,b=1;a>>>b") ); michael@0: // += michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a+=b;a", michael@0: 7, michael@0: eval("var a=4,b=3;a+=b;a") ); michael@0: michael@0: // -= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a-=b;a", michael@0: 1, michael@0: eval("var a=4,b=3;a-=b;a") ); michael@0: // *= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a*=b;a", michael@0: 12, michael@0: eval("var a=4,b=3;a*=b;a") ); michael@0: // += michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a+=b;a", michael@0: 7, michael@0: eval("var a=4,b=3;a+=b;a") ); michael@0: // /= michael@0: new TestCase( SECTION, michael@0: "var a=12,b=3;a/=b;a", michael@0: 4, michael@0: eval("var a=12,b=3;a/=b;a") ); michael@0: michael@0: // &= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=5;a&=b;a", michael@0: 4, michael@0: eval("var a=4,b=5;a&=b;a") ); michael@0: michael@0: // |= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=5;a&=b;a", michael@0: 5, michael@0: eval("var a=4,b=5;a|=b;a") ); michael@0: // ^= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=5;a^=b;a", michael@0: 1, michael@0: eval("var a=4,b=5;a^=b;a") ); michael@0: // %= michael@0: new TestCase( SECTION, michael@0: "var a=12,b=5;a%=b;a", michael@0: 2, michael@0: eval("var a=12,b=5;a%=b;a") ); michael@0: // <<= michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;a<<=b;a", michael@0: 32, michael@0: eval("var a=4,b=3;a<<=b;a") ); michael@0: michael@0: // >> michael@0: new TestCase( SECTION, michael@0: "var a=4,b=1;a>>=b;a", michael@0: 2, michael@0: eval("var a=4,b=1;a>>=b;a") ); michael@0: michael@0: // >>> michael@0: new TestCase( SECTION, michael@0: "var a=1,b=1;a>>>=b;a", michael@0: 0, michael@0: eval("var a=1,b=1;a>>>=b;a") ); michael@0: michael@0: // () michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;(a)", michael@0: 4, michael@0: eval("var a=4,b=3;(a)") ); michael@0: // {} michael@0: new TestCase( SECTION, michael@0: "var a=4,b=3;{b}", michael@0: 3, michael@0: eval("var a=4,b=3;{b}") ); michael@0: michael@0: // [] michael@0: new TestCase( SECTION, michael@0: "var a=new Array('hi');a[0]", michael@0: "hi", michael@0: eval("var a=new Array('hi');a[0]") ); michael@0: // [] michael@0: new TestCase( SECTION, michael@0: ";", michael@0: void 0, michael@0: eval(";") ); michael@0: test(); michael@0: