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 ***** */
42 ECMA Section: Punctuators
45 This tests verifies that all ECMA punctutors are recognized as a
46 token separator, but does not attempt to verify the functionality
49 Author: christine@netscape.com
50 Date: 12 november 1997
54 var VERSION = "ECMA_1";
56 var TITLE = "Punctuators";
58 writeHeaderToLog( SECTION + " "+ TITLE);
61 new TestCase( SECTION,
64 eval("var c,d;c==d") );
68 new TestCase( SECTION,
71 eval("var a=true;a") );
74 new TestCase( SECTION,
75 "var a=true,b=false;a>b",
77 eval("var a=true,b=false;a>b") );
80 new TestCase( SECTION,
81 "var a=true,b=false;a<b",
83 eval("var a=true,b=false;a<b") );
86 new TestCase( SECTION,
87 "var a=0xFFFF,b=0X0FFF;a<=b",
89 eval("var a=0xFFFF,b=0X0FFF;a<=b") );
92 new TestCase( SECTION,
93 "var a=0xFFFF,b=0XFFFE;a>=b",
95 eval("var a=0xFFFF,b=0XFFFE;a>=b") );
98 new TestCase( SECTION,
99 "var a=true,b=false;a!=b",
101 eval("var a=true,b=false;a!=b") );
103 new TestCase( SECTION,
104 "var a=false,b=false;a!=b",
106 eval("var a=false,b=false;a!=b") );
108 new TestCase( SECTION,
109 "var a=true,b=false;a,b",
111 eval("var a=true,b=false;a,b") );
113 new TestCase( SECTION,
114 "var a=true,b=false;!a",
116 eval("var a=true,b=false;!a") );
119 new TestCase( SECTION,
122 eval("var a=true;~a") );
124 new TestCase( SECTION,
125 "var a=true; (a ? 'PASS' : '')",
127 eval("var a=true; (a ? 'PASS' : '')") );
131 new TestCase( SECTION,
132 "var a=false; (a ? 'FAIL' : 'PASS')",
134 eval("var a=false; (a ? 'FAIL' : 'PASS')") );
137 new TestCase( SECTION,
138 "var a=Number;a.NaN",
140 eval("var a=Number;a.NaN") );
143 new TestCase( SECTION,
144 "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
146 eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
149 new TestCase( SECTION,
150 "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
152 eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
154 new TestCase( SECTION,
155 "var a=false,b=false;++a",
157 eval("var a=false,b=false;++a") );
159 new TestCase( SECTION,
160 "var a=true,b=false--a",
162 eval("var a=true,b=false;--a") );
165 new TestCase( SECTION,
166 "var a=true,b=true;a+b",
168 eval("var a=true,b=true;a+b") );
170 new TestCase( SECTION,
171 "var a=true,b=true;a-b",
173 eval("var a=true,b=true;a-b") );
175 new TestCase( SECTION,
176 "var a=true,b=true;a*b",
178 eval("var a=true,b=true;a*b") );
180 new TestCase( SECTION,
181 "var a=true,b=true;a/b",
183 eval("var a=true,b=true;a/b") );
185 new TestCase( SECTION,
188 eval("var a=3,b=2;a&b") );
190 new TestCase( SECTION,
193 eval("var a=4,b=3;a|b") );
196 new TestCase( SECTION,
199 eval("var a=4,b=3;a^b") );
202 new TestCase( SECTION,
205 eval("var a=4,b=3;a%b") );
208 new TestCase( SECTION,
211 eval("var a=4,b=3;a<<b") );
214 new TestCase( SECTION,
217 eval("var a=4,b=1;a>>b") );
220 new TestCase( SECTION,
223 eval("var a=1,b=1;a>>>b") );
225 new TestCase( SECTION,
226 "var a=4,b=3;a+=b;a",
228 eval("var a=4,b=3;a+=b;a") );
231 new TestCase( SECTION,
232 "var a=4,b=3;a-=b;a",
234 eval("var a=4,b=3;a-=b;a") );
236 new TestCase( SECTION,
237 "var a=4,b=3;a*=b;a",
239 eval("var a=4,b=3;a*=b;a") );
241 new TestCase( SECTION,
242 "var a=4,b=3;a+=b;a",
244 eval("var a=4,b=3;a+=b;a") );
246 new TestCase( SECTION,
247 "var a=12,b=3;a/=b;a",
249 eval("var a=12,b=3;a/=b;a") );
252 new TestCase( SECTION,
253 "var a=4,b=5;a&=b;a",
255 eval("var a=4,b=5;a&=b;a") );
258 new TestCase( SECTION,
259 "var a=4,b=5;a&=b;a",
261 eval("var a=4,b=5;a|=b;a") );
263 new TestCase( SECTION,
264 "var a=4,b=5;a^=b;a",
266 eval("var a=4,b=5;a^=b;a") );
268 new TestCase( SECTION,
269 "var a=12,b=5;a%=b;a",
271 eval("var a=12,b=5;a%=b;a") );
273 new TestCase( SECTION,
274 "var a=4,b=3;a<<=b;a",
276 eval("var a=4,b=3;a<<=b;a") );
279 new TestCase( SECTION,
280 "var a=4,b=1;a>>=b;a",
282 eval("var a=4,b=1;a>>=b;a") );
285 new TestCase( SECTION,
286 "var a=1,b=1;a>>>=b;a",
288 eval("var a=1,b=1;a>>>=b;a") );
291 new TestCase( SECTION,
294 eval("var a=4,b=3;(a)") );
296 new TestCase( SECTION,
299 eval("var a=4,b=3;{b}") );
302 new TestCase( SECTION,
303 "var a=new Array('hi');a[0]",
305 eval("var a=new Array('hi');a[0]") );
307 new TestCase( SECTION,