]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/LexicalConventions/7.7.3-1.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma / LexicalConventions / 7.7.3-1.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/
5 *
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.
10 *
11 * The Original Code is Mozilla Communicator client code, released March
12 * 31, 1998.
13 *
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
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 */
22 /**
23 File Name: 7.7.3-1.js
24 ECMA Section: 7.7.3 Numeric Literals
25
26 Description: A numeric literal stands for a value of the Number type
27 This value is determined in two steps: first a
28 mathematical value (MV) is derived from the literal;
29 second, this mathematical value is rounded, ideally
30 using IEEE 754 round-to-nearest mode, to a reprentable
31 value of of the number type.
32
33 These test cases came from Waldemar.
34
35 Author: christine@netscape.com
36 Date: 12 June 1998
37 */
38
39 var SECTION = "7.7.3-1";
40 var VERSION = "ECMA_1";
41 startTest();
42 var TITLE = "Numeric Literals";
43 var BUGNUMBER="122877";
44
45 writeHeaderToLog( SECTION + " "+ TITLE);
46
47 var testcases = new Array();
48
49
50 testcases[tc++] = new TestCase( SECTION,
51 "0x12345678",
52 305419896,
53 0x12345678 );
54
55 testcases[tc++] = new TestCase( SECTION,
56 "0x80000000",
57 2147483648,
58 0x80000000 );
59
60 testcases[tc++] = new TestCase( SECTION,
61 "0xffffffff",
62 4294967295,
63 0xffffffff );
64
65 testcases[tc++] = new TestCase( SECTION,
66 "0x100000000",
67 4294967296,
68 0x100000000 );
69
70 testcases[tc++] = new TestCase( SECTION,
71 "077777777777777777",
72 2251799813685247,
73 077777777777777777 );
74
75 testcases[tc++] = new TestCase( SECTION,
76 "077777777777777776",
77 2251799813685246,
78 077777777777777776 );
79
80 testcases[tc++] = new TestCase( SECTION,
81 "0x1fffffffffffff",
82 9007199254740991,
83 0x1fffffffffffff );
84
85 testcases[tc++] = new TestCase( SECTION,
86 "0x20000000000000",
87 9007199254740992,
88 0x20000000000000 );
89
90 testcases[tc++] = new TestCase( SECTION,
91 "0x20123456789abc",
92 9027215253084860,
93 0x20123456789abc );
94
95 testcases[tc++] = new TestCase( SECTION,
96 "0x20123456789abd",
97 9027215253084860,
98 0x20123456789abd );
99
100 testcases[tc++] = new TestCase( SECTION,
101 "0x20123456789abe",
102 9027215253084862,
103 0x20123456789abe );
104
105 testcases[tc++] = new TestCase( SECTION,
106 "0x20123456789abf",
107 9027215253084864,
108 0x20123456789abf );
109
110 testcases[tc++] = new TestCase( SECTION,
111 "0x1000000000000080",
112 1152921504606847000,
113 0x1000000000000080 );
114
115 testcases[tc++] = new TestCase( SECTION,
116 "0x1000000000000081",
117 1152921504606847200,
118 0x1000000000000081 );
119
120 testcases[tc++] = new TestCase( SECTION,
121 "0x1000000000000100",
122 1152921504606847200,
123 0x1000000000000100 );
124
125 testcases[tc++] = new TestCase( SECTION,
126 "0x100000000000017f",
127 1152921504606847200,
128 0x100000000000017f );
129
130 testcases[tc++] = new TestCase( SECTION,
131 "0x1000000000000180",
132 1152921504606847500,
133 0x1000000000000180 );
134
135 testcases[tc++] = new TestCase( SECTION,
136 "0x1000000000000181",
137 1152921504606847500,
138 0x1000000000000181 );
139
140 testcases[tc++] = new TestCase( SECTION,
141 "0x10000000000001f0",
142 1152921504606847500,
143 0x10000000000001f0 );
144
145 testcases[tc++] = new TestCase( SECTION,
146 "0x1000000000000200",
147 1152921504606847500,
148 0x1000000000000200 );
149
150 testcases[tc++] = new TestCase( SECTION,
151 "0x100000000000027f",
152 1152921504606847500,
153 0x100000000000027f );
154
155 testcases[tc++] = new TestCase( SECTION,
156 "0x1000000000000280",
157 1152921504606847500,
158 0x1000000000000280 );
159
160 testcases[tc++] = new TestCase( SECTION,
161 "0x1000000000000281",
162 1152921504606847700,
163 0x1000000000000281 );
164
165 testcases[tc++] = new TestCase( SECTION,
166 "0x10000000000002ff",
167 1152921504606847700,
168 0x10000000000002ff );
169
170 testcases[tc++] = new TestCase( SECTION,
171 "0x1000000000000300",
172 1152921504606847700,
173 0x1000000000000300 );
174
175 testcases[tc++] = new TestCase( SECTION,
176 "0x10000000000000000",
177 18446744073709552000,
178 0x10000000000000000 );
179
180 test();
181
182 function test() {
183 for ( tc=0; tc < testcases.length; tc++ ) {
184 testcases[tc].actual = testcases[tc].actual;
185
186 testcases[tc].passed = writeTestCaseResult(
187 testcases[tc].expect,
188 testcases[tc].actual,
189 testcases[tc].description +" = "+ testcases[tc].actual );
190
191 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
192
193 }
194
195 stopTest();
196 return ( testcases );
197 }