1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla Communicator client code, released
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
43 ECMA Section: Punctuators
46 This tests verifies that all ECMA punctutors are recognized as a
47 token separator, but does not attempt to verify the functionality
50 Author: christine@netscape.com
51 Date: 12 november 1997
55 var VERSION = "ECMA_1";
57 var TITLE = "Punctuators";
59 writeHeaderToLog( SECTION + " "+ TITLE);
62 new TestCase( SECTION,
65 eval("var c,d;c==d") );
69 new TestCase( SECTION,
72 eval("var a=true;a") );
75 new TestCase( SECTION,
76 "var a=true,b=false;a>b",
78 eval("var a=true,b=false;a>b") );
81 new TestCase( SECTION,
82 "var a=true,b=false;a<b",
84 eval("var a=true,b=false;a<b") );
87 new TestCase( SECTION,
88 "var a=0xFFFF,b=0X0FFF;a<=b",
90 eval("var a=0xFFFF,b=0X0FFF;a<=b") );
93 new TestCase( SECTION,
94 "var a=0xFFFF,b=0XFFFE;a>=b",
96 eval("var a=0xFFFF,b=0XFFFE;a>=b") );
99 new TestCase( SECTION,
100 "var a=true,b=false;a!=b",
102 eval("var a=true,b=false;a!=b") );
104 new TestCase( SECTION,
105 "var a=false,b=false;a!=b",
107 eval("var a=false,b=false;a!=b") );
109 new TestCase( SECTION,
110 "var a=true,b=false;a,b",
112 eval("var a=true,b=false;a,b") );
114 new TestCase( SECTION,
115 "var a=true,b=false;!a",
117 eval("var a=true,b=false;!a") );
120 new TestCase( SECTION,
123 eval("var a=true;~a") );
125 new TestCase( SECTION,
126 "var a=true; (a ? 'PASS' : '')",
128 eval("var a=true; (a ? 'PASS' : '')") );
132 new TestCase( SECTION,
133 "var a=false; (a ? 'FAIL' : 'PASS')",
135 eval("var a=false; (a ? 'FAIL' : 'PASS')") );
138 new TestCase( SECTION,
139 "var a=Number;a.NaN",
141 eval("var a=Number;a.NaN") );
144 new TestCase( SECTION,
145 "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
147 eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
150 new TestCase( SECTION,
151 "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
153 eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
155 new TestCase( SECTION,
156 "var a=false,b=false;++a",
158 eval("var a=false,b=false;++a") );
160 new TestCase( SECTION,
161 "var a=true,b=false--a",
163 eval("var a=true,b=false;--a") );
166 new TestCase( SECTION,
167 "var a=true,b=true;a+b",
169 eval("var a=true,b=true;a+b") );
171 new TestCase( SECTION,
172 "var a=true,b=true;a-b",
174 eval("var a=true,b=true;a-b") );
176 new TestCase( SECTION,
177 "var a=true,b=true;a*b",
179 eval("var a=true,b=true;a*b") );
181 new TestCase( SECTION,
182 "var a=true,b=true;a/b",
184 eval("var a=true,b=true;a/b") );
186 new TestCase( SECTION,
189 eval("var a=3,b=2;a&b") );
191 new TestCase( SECTION,
194 eval("var a=4,b=3;a|b") );
197 new TestCase( SECTION,
200 eval("var a=4,b=3;a^b") );
203 new TestCase( SECTION,
206 eval("var a=4,b=3;a%b") );
209 new TestCase( SECTION,
212 eval("var a=4,b=3;a<<b") );
215 new TestCase( SECTION,
218 eval("var a=4,b=1;a>>b") );
221 new TestCase( SECTION,
224 eval("var a=1,b=1;a>>>b") );
226 new TestCase( SECTION,
227 "var a=4,b=3;a+=b;a",
229 eval("var a=4,b=3;a+=b;a") );
232 new TestCase( SECTION,
233 "var a=4,b=3;a-=b;a",
235 eval("var a=4,b=3;a-=b;a") );
237 new TestCase( SECTION,
238 "var a=4,b=3;a*=b;a",
240 eval("var a=4,b=3;a*=b;a") );
242 new TestCase( SECTION,
243 "var a=4,b=3;a+=b;a",
245 eval("var a=4,b=3;a+=b;a") );
247 new TestCase( SECTION,
248 "var a=12,b=3;a/=b;a",
250 eval("var a=12,b=3;a/=b;a") );
253 new TestCase( SECTION,
254 "var a=4,b=5;a&=b;a",
256 eval("var a=4,b=5;a&=b;a") );
259 new TestCase( SECTION,
260 "var a=4,b=5;a&=b;a",
262 eval("var a=4,b=5;a|=b;a") );
264 new TestCase( SECTION,
265 "var a=4,b=5;a^=b;a",
267 eval("var a=4,b=5;a^=b;a") );
269 new TestCase( SECTION,
270 "var a=12,b=5;a%=b;a",
272 eval("var a=12,b=5;a%=b;a") );
274 new TestCase( SECTION,
275 "var a=4,b=3;a<<=b;a",
277 eval("var a=4,b=3;a<<=b;a") );
280 new TestCase( SECTION,
281 "var a=4,b=1;a>>=b;a",
283 eval("var a=4,b=1;a>>=b;a") );
286 new TestCase( SECTION,
287 "var a=1,b=1;a>>>=b;a",
289 eval("var a=1,b=1;a>>>=b;a") );
292 new TestCase( SECTION,
295 eval("var a=4,b=3;(a)") );
297 new TestCase( SECTION,
300 eval("var a=4,b=3;{b}") );
303 new TestCase( SECTION,
304 "var a=new Array('hi');a[0]",
306 eval("var a=new Array('hi');a[0]") );
308 new TestCase( SECTION,