Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / ecma / LexicalConventions / 7.7.3-1.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.7.3-1.js
42    ECMA Section:       7.7.3 Numeric Literals
43
44    Description:        A numeric literal stands for a value of the Number type
45    This value is determined in two steps:  first a
46    mathematical value (MV) is derived from the literal;
47    second, this mathematical value is rounded, ideally
48    using IEEE 754 round-to-nearest mode, to a reprentable
49    value of of the number type.
50
51    These test cases came from Waldemar.
52
53    Author:             christine@netscape.com
54    Date:               12 June 1998
55 */
56
57 var SECTION = "7.7.3-1";
58 var VERSION = "ECMA_1";
59 var TITLE   = "Numeric Literals";
60 var BUGNUMBER="122877";
61
62 startTest();
63
64 writeHeaderToLog( SECTION + " "+ TITLE);
65
66 new TestCase( SECTION,
67               "0x12345678",
68               305419896,
69               0x12345678 );
70
71 new TestCase( SECTION,
72               "0x80000000",
73               2147483648,
74               0x80000000 );
75
76 new TestCase( SECTION,
77               "0xffffffff",
78               4294967295,
79               0xffffffff );
80
81 new TestCase( SECTION,
82               "0x100000000",
83               4294967296,
84               0x100000000 );
85
86 new TestCase( SECTION,
87               "077777777777777777",
88               2251799813685247,
89               077777777777777777 );
90
91 new TestCase( SECTION,
92               "077777777777777776",
93               2251799813685246,
94               077777777777777776 );
95
96 new TestCase( SECTION,
97               "0x1fffffffffffff",
98               9007199254740991,
99               0x1fffffffffffff );
100
101 new TestCase( SECTION,
102               "0x20000000000000",
103               9007199254740992,
104               0x20000000000000 );
105
106 new TestCase( SECTION,
107               "0x20123456789abc",
108               9027215253084860,
109               0x20123456789abc );
110
111 new TestCase( SECTION,
112               "0x20123456789abd",
113               9027215253084860,
114               0x20123456789abd );
115
116 new TestCase( SECTION,
117               "0x20123456789abe",
118               9027215253084862,
119               0x20123456789abe );
120
121 new TestCase( SECTION,
122               "0x20123456789abf",
123               9027215253084864,
124               0x20123456789abf );
125
126 new TestCase( SECTION,
127               "0x1000000000000080",
128               1152921504606847000,
129               0x1000000000000080 );
130
131 new TestCase( SECTION,
132               "0x1000000000000081",
133               1152921504606847200,
134               0x1000000000000081 );
135
136 new TestCase( SECTION,
137               "0x1000000000000100",
138               1152921504606847200,
139               0x1000000000000100 );
140
141 new TestCase( SECTION,
142               "0x100000000000017f",
143               1152921504606847200,
144               0x100000000000017f );
145
146 new TestCase( SECTION,
147               "0x1000000000000180",
148               1152921504606847500,
149               0x1000000000000180 );
150
151 new TestCase( SECTION,
152               "0x1000000000000181",
153               1152921504606847500,
154               0x1000000000000181 );
155
156 new TestCase( SECTION,
157               "0x10000000000001f0",
158               1152921504606847500,
159               0x10000000000001f0 );
160
161 new TestCase( SECTION,
162               "0x1000000000000200",
163               1152921504606847500,
164               0x1000000000000200 );
165
166 new TestCase( SECTION,
167               "0x100000000000027f",
168               1152921504606847500,
169               0x100000000000027f );
170
171 new TestCase( SECTION,
172               "0x1000000000000280",
173               1152921504606847500,
174               0x1000000000000280 );
175
176 new TestCase( SECTION,
177               "0x1000000000000281",
178               1152921504606847700,
179               0x1000000000000281 );
180
181 new TestCase( SECTION,
182               "0x10000000000002ff",
183               1152921504606847700,
184               0x10000000000002ff );
185
186 new TestCase( SECTION,
187               "0x1000000000000300",
188               1152921504606847700,
189               0x1000000000000300 );
190
191 new TestCase( SECTION,
192               "0x10000000000000000",
193               18446744073709552000,
194               0x10000000000000000 );
195
196 test();
197