Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 es5id: 15.1.2.3_A6
11 es6id: 18.2.4
12 esid: sec-parsefloat-string
13 description: Complex test without eval
14 includes: [decimalToHexString.js]
15 ---*/
16
17 //CHECK
18 var errorCount = 0;
19 var count = 0;
20 var indexP;
21 var indexO = 0;
22 for (var index = 0; index <= 65535; index++) {
23 if ((index < 0x0030) || (index > 0x0039)) {
24 var hex = decimalToHexString(index);
25 if (parseFloat("0.1e1" + String.fromCharCode(index)) !== 1) {
26 if (indexO === 0) {
27 indexO = index;
28 } else {
29 if ((index - indexP) !== 1) {
30 if ((indexP - indexO) !== 0) {
31 var hexP = decimalToHexString(indexP);
32 var hexO = decimalToHexString(indexO);
33 $ERROR('#' + hexO + '-' + hexP + ' ');
34 }
35 else {
36 var hexP = decimalToHexString(indexP);
37 $ERROR('#' + hexP + ' ');
38 }
39 indexO = index;
40 }
41 }
42 indexP = index;
43 errorCount++;
44 }
45 count++;
46 }
47 }
48
49 if (errorCount > 0) {
50 if ((indexP - indexO) !== 0) {
51 var hexP = decimalToHexString(indexP);
52 var hexO = decimalToHexString(indexO);
53 $ERROR('#' + hexO + '-' + hexP + ' ');
54 } else {
55 var hexP = decimalToHexString(indexP);
56 $ERROR('#' + hexP + ' ');
57 }
58 $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
59 }