|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 /** |
|
8 File Name: 7.7.3-1.js |
|
9 ECMA Section: 7.7.3 Numeric Literals |
|
10 |
|
11 Description: A numeric literal stands for a value of the Number type |
|
12 This value is determined in two steps: first a |
|
13 mathematical value (MV) is derived from the literal; |
|
14 second, this mathematical value is rounded, ideally |
|
15 using IEEE 754 round-to-nearest mode, to a reprentable |
|
16 value of of the number type. |
|
17 |
|
18 These test cases came from Waldemar. |
|
19 |
|
20 Author: christine@netscape.com |
|
21 Date: 12 June 1998 |
|
22 */ |
|
23 |
|
24 var SECTION = "7.7.3-1"; |
|
25 var VERSION = "ECMA_1"; |
|
26 var TITLE = "Numeric Literals"; |
|
27 var BUGNUMBER="122877"; |
|
28 |
|
29 startTest(); |
|
30 |
|
31 writeHeaderToLog( SECTION + " "+ TITLE); |
|
32 |
|
33 new TestCase( SECTION, |
|
34 "0x12345678", |
|
35 305419896, |
|
36 0x12345678 ); |
|
37 |
|
38 new TestCase( SECTION, |
|
39 "0x80000000", |
|
40 2147483648, |
|
41 0x80000000 ); |
|
42 |
|
43 new TestCase( SECTION, |
|
44 "0xffffffff", |
|
45 4294967295, |
|
46 0xffffffff ); |
|
47 |
|
48 new TestCase( SECTION, |
|
49 "0x100000000", |
|
50 4294967296, |
|
51 0x100000000 ); |
|
52 |
|
53 new TestCase( SECTION, |
|
54 "077777777777777777", |
|
55 2251799813685247, |
|
56 077777777777777777 ); |
|
57 |
|
58 new TestCase( SECTION, |
|
59 "077777777777777776", |
|
60 2251799813685246, |
|
61 077777777777777776 ); |
|
62 |
|
63 new TestCase( SECTION, |
|
64 "0x1fffffffffffff", |
|
65 9007199254740991, |
|
66 0x1fffffffffffff ); |
|
67 |
|
68 new TestCase( SECTION, |
|
69 "0x20000000000000", |
|
70 9007199254740992, |
|
71 0x20000000000000 ); |
|
72 |
|
73 new TestCase( SECTION, |
|
74 "0x20123456789abc", |
|
75 9027215253084860, |
|
76 0x20123456789abc ); |
|
77 |
|
78 new TestCase( SECTION, |
|
79 "0x20123456789abd", |
|
80 9027215253084860, |
|
81 0x20123456789abd ); |
|
82 |
|
83 new TestCase( SECTION, |
|
84 "0x20123456789abe", |
|
85 9027215253084862, |
|
86 0x20123456789abe ); |
|
87 |
|
88 new TestCase( SECTION, |
|
89 "0x20123456789abf", |
|
90 9027215253084864, |
|
91 0x20123456789abf ); |
|
92 |
|
93 new TestCase( SECTION, |
|
94 "0x1000000000000080", |
|
95 1152921504606847000, |
|
96 0x1000000000000080 ); |
|
97 |
|
98 new TestCase( SECTION, |
|
99 "0x1000000000000081", |
|
100 1152921504606847200, |
|
101 0x1000000000000081 ); |
|
102 |
|
103 new TestCase( SECTION, |
|
104 "0x1000000000000100", |
|
105 1152921504606847200, |
|
106 0x1000000000000100 ); |
|
107 |
|
108 new TestCase( SECTION, |
|
109 "0x100000000000017f", |
|
110 1152921504606847200, |
|
111 0x100000000000017f ); |
|
112 |
|
113 new TestCase( SECTION, |
|
114 "0x1000000000000180", |
|
115 1152921504606847500, |
|
116 0x1000000000000180 ); |
|
117 |
|
118 new TestCase( SECTION, |
|
119 "0x1000000000000181", |
|
120 1152921504606847500, |
|
121 0x1000000000000181 ); |
|
122 |
|
123 new TestCase( SECTION, |
|
124 "0x10000000000001f0", |
|
125 1152921504606847500, |
|
126 0x10000000000001f0 ); |
|
127 |
|
128 new TestCase( SECTION, |
|
129 "0x1000000000000200", |
|
130 1152921504606847500, |
|
131 0x1000000000000200 ); |
|
132 |
|
133 new TestCase( SECTION, |
|
134 "0x100000000000027f", |
|
135 1152921504606847500, |
|
136 0x100000000000027f ); |
|
137 |
|
138 new TestCase( SECTION, |
|
139 "0x1000000000000280", |
|
140 1152921504606847500, |
|
141 0x1000000000000280 ); |
|
142 |
|
143 new TestCase( SECTION, |
|
144 "0x1000000000000281", |
|
145 1152921504606847700, |
|
146 0x1000000000000281 ); |
|
147 |
|
148 new TestCase( SECTION, |
|
149 "0x10000000000002ff", |
|
150 1152921504606847700, |
|
151 0x10000000000002ff ); |
|
152 |
|
153 new TestCase( SECTION, |
|
154 "0x1000000000000300", |
|
155 1152921504606847700, |
|
156 0x1000000000000300 ); |
|
157 |
|
158 new TestCase( SECTION, |
|
159 "0x10000000000000000", |
|
160 18446744073709552000, |
|
161 0x10000000000000000 ); |
|
162 |
|
163 test(); |
|
164 |