Merge "fix: the incorrect version of tarball generated by gbs export" into tizen
[platform/upstream/js.git] / js / src / tests / ecma / LexicalConventions / 7.6.js
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
4  *
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/
9  *
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
13  * License.
14  *
15  * The Original Code is Mozilla Communicator client code, released
16  * March 31, 1998.
17  *
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.
22  *
23  * Contributor(s):
24  *
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.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39
40 /**
41    File Name:          7.6.js
42    ECMA Section:       Punctuators
43    Description:
44
45    This tests verifies that all ECMA punctutors are recognized as a
46    token separator, but does not attempt to verify the functionality
47    of any punctuator.
48
49    Author:             christine@netscape.com
50    Date:               12 november 1997
51 */
52
53 var SECTION = "7.6";
54 var VERSION = "ECMA_1";
55 startTest();
56 var TITLE   = "Punctuators";
57
58 writeHeaderToLog( SECTION + " "+ TITLE);
59
60 // ==
61 new TestCase( SECTION,
62               "var c,d;c==d",
63               true,
64               eval("var c,d;c==d") );
65
66 // =
67
68 new TestCase( SECTION,
69               "var a=true;a",
70               true,
71               eval("var a=true;a") );
72
73 // >
74 new TestCase( SECTION,
75               "var a=true,b=false;a>b",
76               true,
77               eval("var a=true,b=false;a>b") );
78
79 // <
80 new TestCase( SECTION,
81               "var a=true,b=false;a<b",
82               false,
83               eval("var a=true,b=false;a<b") );
84
85 // <=
86 new TestCase( SECTION,
87               "var a=0xFFFF,b=0X0FFF;a<=b",
88               false,
89               eval("var a=0xFFFF,b=0X0FFF;a<=b") );
90
91 // >=
92 new TestCase( SECTION,
93               "var a=0xFFFF,b=0XFFFE;a>=b",
94               true,
95               eval("var a=0xFFFF,b=0XFFFE;a>=b") );
96
97 // !=
98 new TestCase( SECTION,
99               "var a=true,b=false;a!=b",
100               true,
101               eval("var a=true,b=false;a!=b") );
102
103 new TestCase( SECTION,
104               "var a=false,b=false;a!=b",
105               false,
106               eval("var a=false,b=false;a!=b") );
107 // ,
108 new TestCase( SECTION,
109               "var a=true,b=false;a,b",
110               false,
111               eval("var a=true,b=false;a,b") );
112 // !
113 new TestCase( SECTION,
114               "var a=true,b=false;!a",
115               false,
116               eval("var a=true,b=false;!a") );
117
118 // ~
119 new TestCase( SECTION,
120               "var a=true;~a",
121               -2,
122               eval("var a=true;~a") );
123 // ?
124 new TestCase( SECTION,
125               "var a=true; (a ? 'PASS' : '')",
126               "PASS",
127               eval("var a=true; (a ? 'PASS' : '')") );
128
129 // :
130
131 new TestCase( SECTION,
132               "var a=false; (a ? 'FAIL' : 'PASS')",
133               "PASS",
134               eval("var a=false; (a ? 'FAIL' : 'PASS')") );
135 // .
136
137 new TestCase( SECTION,
138               "var a=Number;a.NaN",
139               NaN,
140               eval("var a=Number;a.NaN") );
141
142 // &&
143 new TestCase( SECTION,
144               "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
145               "PASS",
146               eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
147
148 // ||
149 new TestCase( SECTION,
150               "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
151               "PASS",
152               eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
153 // ++
154 new TestCase( SECTION,
155               "var a=false,b=false;++a",
156               1,
157               eval("var a=false,b=false;++a") );
158 // --
159 new TestCase( SECTION,
160               "var a=true,b=false--a",
161               0,
162               eval("var a=true,b=false;--a") );
163 // +
164
165 new TestCase( SECTION,
166               "var a=true,b=true;a+b",
167               2,
168               eval("var a=true,b=true;a+b") );
169 // -
170 new TestCase( SECTION,
171               "var a=true,b=true;a-b",
172               0,
173               eval("var a=true,b=true;a-b") );
174 // *
175 new TestCase( SECTION,
176               "var a=true,b=true;a*b",
177               1,
178               eval("var a=true,b=true;a*b") );
179 // /
180 new TestCase( SECTION,
181               "var a=true,b=true;a/b",
182               1,
183               eval("var a=true,b=true;a/b") );
184 // &
185 new TestCase( SECTION,
186               "var a=3,b=2;a&b",
187               2,
188               eval("var a=3,b=2;a&b") );
189 // |
190 new TestCase( SECTION,
191               "var a=4,b=3;a|b",
192               7,
193               eval("var a=4,b=3;a|b") );
194
195 // |
196 new TestCase( SECTION,
197               "var a=4,b=3;a^b",
198               7,
199               eval("var a=4,b=3;a^b") );
200
201 // %
202 new TestCase( SECTION,
203               "var a=4,b=3;a|b",
204               1,
205               eval("var a=4,b=3;a%b") );
206
207 // <<
208 new TestCase( SECTION,
209               "var a=4,b=3;a<<b",
210               32,
211               eval("var a=4,b=3;a<<b") );
212
213 //  >>
214 new TestCase( SECTION,
215               "var a=4,b=1;a>>b",
216               2,
217               eval("var a=4,b=1;a>>b") );
218
219 //  >>>
220 new TestCase( SECTION,
221               "var a=1,b=1;a>>>b",
222               0,
223               eval("var a=1,b=1;a>>>b") );
224 //  +=
225 new TestCase( SECTION,
226               "var a=4,b=3;a+=b;a",
227               7,
228               eval("var a=4,b=3;a+=b;a") );
229
230 //  -=
231 new TestCase( SECTION,
232               "var a=4,b=3;a-=b;a",
233               1,
234               eval("var a=4,b=3;a-=b;a") );
235 //  *=
236 new TestCase( SECTION,
237               "var a=4,b=3;a*=b;a",
238               12,
239               eval("var a=4,b=3;a*=b;a") );
240 //  +=
241 new TestCase( SECTION,
242               "var a=4,b=3;a+=b;a",
243               7,
244               eval("var a=4,b=3;a+=b;a") );
245 //  /=
246 new TestCase( SECTION,
247               "var a=12,b=3;a/=b;a",
248               4,
249               eval("var a=12,b=3;a/=b;a") );
250
251 //  &=
252 new TestCase( SECTION,
253               "var a=4,b=5;a&=b;a",
254               4,
255               eval("var a=4,b=5;a&=b;a") );
256
257 // |=
258 new TestCase( SECTION,
259               "var a=4,b=5;a&=b;a",
260               5,
261               eval("var a=4,b=5;a|=b;a") );
262 //  ^=
263 new TestCase( SECTION,
264               "var a=4,b=5;a^=b;a",
265               1,
266               eval("var a=4,b=5;a^=b;a") );
267 // %=
268 new TestCase( SECTION,
269               "var a=12,b=5;a%=b;a",
270               2,
271               eval("var a=12,b=5;a%=b;a") );
272 // <<=
273 new TestCase( SECTION,
274               "var a=4,b=3;a<<=b;a",
275               32,
276               eval("var a=4,b=3;a<<=b;a") );
277
278 //  >>
279 new TestCase( SECTION,
280               "var a=4,b=1;a>>=b;a",
281               2,
282               eval("var a=4,b=1;a>>=b;a") );
283
284 //  >>>
285 new TestCase( SECTION,
286               "var a=1,b=1;a>>>=b;a",
287               0,
288               eval("var a=1,b=1;a>>>=b;a") );
289
290 // ()
291 new TestCase( SECTION,
292               "var a=4,b=3;(a)",
293               4,
294               eval("var a=4,b=3;(a)") );
295 // {}
296 new TestCase( SECTION,
297               "var a=4,b=3;{b}",
298               3,
299               eval("var a=4,b=3;{b}") );
300
301 // []
302 new TestCase( SECTION,
303               "var a=new Array('hi');a[0]",
304               "hi",
305               eval("var a=new Array('hi');a[0]") );
306 // []
307 new TestCase( SECTION,
308               ";",
309               void 0,
310               eval(";") );
311 test();
312