Debian Codegraph @

js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A6.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 parseFloat may interpret only a leading portion of the string as
7 a number value; it ignores any characters that cannot be interpreted as part
8 of the notation of an decimal literal, and no indication is given that any such
9 characters were ignored.
10 esid: sec-parsefloat-string
11 description: Complex test without eval
12 includes: [decimalToHexString.js]
13 ---*/
14
15 //CHECK
16 var errorCount = 0;
17 var count = 0;
18 var indexP;
19 var indexO = 0;
20 for (var index = 0; index <= 65535; index++) {
21 if ((index < 0x0030) || (index > 0x0039)) {
22 if (parseFloat("0.1e1" + String.fromCharCode(index)) !== 1) {
23 if (indexO === 0) {
24 indexO = index;
25 } else {
26 if ((index - indexP) !== 1) {
27 if ((indexP - indexO) !== 0) {
28 var hexP = decimalToHexString(indexP);
29 var hexO = decimalToHexString(indexO);
30 throw new Test262Error('#' + hexO + '-' + hexP + ' ');
31 }
32 else {
33 var hexP = decimalToHexString(indexP);
34 throw new Test262Error('#' + hexP + ' ');
35 }
36 indexO = index;
37 }
38 }
39 indexP = index;
40 errorCount++;
41 }
42 count++;
43 }
44 }
45
46 if (errorCount > 0) {
47 if ((indexP - indexO) !== 0) {
48 var hexP = decimalToHexString(indexP);
49 var hexO = decimalToHexString(indexO);
50 throw new Test262Error('#' + hexO + '-' + hexP + ' ');
51 } else {
52 var hexP = decimalToHexString(indexP);
53 throw new Test262Error('#' + hexP + ' ');
54 }
55 throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
56 }
57
58 reportCompare(0, 0);