]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/LexicalConventions/7.6.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
24 ECMA Section: Punctuators
27 This tests verifies that all ECMA punctutors are recognized as a
28 token separator, but does not attempt to verify the functionality
31 Author: christine@netscape.com
32 Date: 12 november 1997
36 var VERSION
= "ECMA_1";
38 var TITLE
= "Punctuators";
40 writeHeaderToLog( SECTION
+ " "+ TITLE
);
42 var testcases
= new Array();
45 testcases
[tc
++] = new TestCase( SECTION
,
48 eval("var c,d;c==d") );
52 testcases
[tc
++] = new TestCase( SECTION
,
55 eval("var a=true;a") );
58 testcases
[tc
++] = new TestCase( SECTION
,
59 "var a=true,b=false;a>b",
61 eval("var a=true,b=false;a>b") );
64 testcases
[tc
++] = new TestCase( SECTION
,
65 "var a=true,b=false;a<b",
67 eval("var a=true,b=false;a<b") );
70 testcases
[tc
++] = new TestCase( SECTION
,
71 "var a=0xFFFF,b=0X0FFF;a<=b",
73 eval("var a=0xFFFF,b=0X0FFF;a<=b") );
76 testcases
[tc
++] = new TestCase( SECTION
,
77 "var a=0xFFFF,b=0XFFFE;a>=b",
79 eval("var a=0xFFFF,b=0XFFFE;a>=b") );
82 testcases
[tc
++] = new TestCase( SECTION
,
83 "var a=true,b=false;a!=b",
85 eval("var a=true,b=false;a!=b") );
87 testcases
[tc
++] = new TestCase( SECTION
,
88 "var a=false,b=false;a!=b",
90 eval("var a=false,b=false;a!=b") );
92 testcases
[tc
++] = new TestCase( SECTION
,
93 "var a=true,b=false;a,b",
95 eval("var a=true,b=false;a,b") );
97 testcases
[tc
++] = new TestCase( SECTION
,
98 "var a=true,b=false;!a",
100 eval("var a=true,b=false;!a") );
103 testcases
[tc
++] = new TestCase( SECTION
,
106 eval("var a=true;~a") );
108 testcases
[tc
++] = new TestCase( SECTION
,
109 "var a=true; (a ? 'PASS' : '')",
111 eval("var a=true; (a ? 'PASS' : '')") );
115 testcases
[tc
++] = new TestCase( SECTION
,
116 "var a=false; (a ? 'FAIL' : 'PASS')",
118 eval("var a=false; (a ? 'FAIL' : 'PASS')") );
121 testcases
[tc
++] = new TestCase( SECTION
,
122 "var a=Number;a.NaN",
124 eval("var a=Number;a.NaN") );
127 testcases
[tc
++] = new TestCase( SECTION
,
128 "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
130 eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
133 testcases
[tc
++] = new TestCase( SECTION
,
134 "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
136 eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
138 testcases
[tc
++] = new TestCase( SECTION
,
139 "var a=false,b=false;++a",
141 eval("var a=false,b=false;++a") );
143 testcases
[tc
++] = new TestCase( SECTION
,
144 "var a=true,b=false--a",
146 eval("var a=true,b=false;--a") );
149 testcases
[tc
++] = new TestCase( SECTION
,
150 "var a=true,b=true;a+b",
152 eval("var a=true,b=true;a+b") );
154 testcases
[tc
++] = new TestCase( SECTION
,
155 "var a=true,b=true;a-b",
157 eval("var a=true,b=true;a-b") );
159 testcases
[tc
++] = new TestCase( SECTION
,
160 "var a=true,b=true;a*b",
162 eval("var a=true,b=true;a*b") );
164 testcases
[tc
++] = new TestCase( SECTION
,
165 "var a=true,b=true;a/b",
167 eval("var a=true,b=true;a/b") );
169 testcases
[tc
++] = new TestCase( SECTION
,
172 eval("var a=3,b=2;a&b") );
174 testcases
[tc
++] = new TestCase( SECTION
,
177 eval("var a=4,b=3;a|b") );
180 testcases
[tc
++] = new TestCase( SECTION
,
183 eval("var a=4,b=3;a^b") );
186 testcases
[tc
++] = new TestCase( SECTION
,
189 eval("var a=4,b=3;a%b") );
192 testcases
[tc
++] = new TestCase( SECTION
,
195 eval("var a=4,b=3;a<<b") );
198 testcases
[tc
++] = new TestCase( SECTION
,
201 eval("var a=4,b=1;a>>b") );
204 testcases
[tc
++] = new TestCase( SECTION
,
207 eval("var a=1,b=1;a>>>b") );
209 testcases
[tc
++] = new TestCase( SECTION
,
210 "var a=4,b=3;a+=b;a",
212 eval("var a=4,b=3;a+=b;a") );
215 testcases
[tc
++] = new TestCase( SECTION
,
216 "var a=4,b=3;a-=b;a",
218 eval("var a=4,b=3;a-=b;a") );
220 testcases
[tc
++] = new TestCase( SECTION
,
221 "var a=4,b=3;a*=b;a",
223 eval("var a=4,b=3;a*=b;a") );
225 testcases
[tc
++] = new TestCase( SECTION
,
226 "var a=4,b=3;a+=b;a",
228 eval("var a=4,b=3;a+=b;a") );
230 testcases
[tc
++] = new TestCase( SECTION
,
231 "var a=12,b=3;a/=b;a",
233 eval("var a=12,b=3;a/=b;a") );
236 testcases
[tc
++] = new TestCase( SECTION
,
237 "var a=4,b=5;a&=b;a",
239 eval("var a=4,b=5;a&=b;a") );
242 testcases
[tc
++] = new TestCase( SECTION
,
243 "var a=4,b=5;a&=b;a",
245 eval("var a=4,b=5;a|=b;a") );
247 testcases
[tc
++] = new TestCase( SECTION
,
248 "var a=4,b=5;a^=b;a",
250 eval("var a=4,b=5;a^=b;a") );
252 testcases
[tc
++] = new TestCase( SECTION
,
253 "var a=12,b=5;a%=b;a",
255 eval("var a=12,b=5;a%=b;a") );
257 testcases
[tc
++] = new TestCase( SECTION
,
258 "var a=4,b=3;a<<=b;a",
260 eval("var a=4,b=3;a<<=b;a") );
263 testcases
[tc
++] = new TestCase( SECTION
,
264 "var a=4,b=1;a>>=b;a",
266 eval("var a=4,b=1;a>>=b;a") );
269 testcases
[tc
++] = new TestCase( SECTION
,
270 "var a=1,b=1;a>>>=b;a",
272 eval("var a=1,b=1;a>>>=b;a") );
275 testcases
[tc
++] = new TestCase( SECTION
,
278 eval("var a=4,b=3;(a)") );
280 testcases
[tc
++] = new TestCase( SECTION
,
283 eval("var a=4,b=3;{b}") );
286 testcases
[tc
++] = new TestCase( SECTION
,
287 "var a=new Array('hi');a[0]",
289 eval("var a=new Array('hi');a[0]") );
291 testcases
[tc
++] = new TestCase( SECTION
,
298 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
299 testcases
[tc
].passed
= writeTestCaseResult(
300 testcases
[tc
].expect
,
301 testcases
[tc
].actual
,
302 testcases
[tc
].description
+" = "+
303 testcases
[tc
].actual
);
305 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";
308 return ( testcases
);