Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/parseFloat/S15.1.2.3_A4_T1.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 Compute the longest prefix of Result(2), which might be Result(2) itself,
7 which satisfies the syntax of a StrDecimalLiteral
8 es5id: 15.1.2.3_A4_T1
9 es6id: 18.2.4
10 esid: sec-parsefloat-string
11 description: Some wrong number
12 ---*/
13
14 //CHECK#1
15 if (parseFloat("0x") !== 0) {
16 $ERROR('#1: parseFloat("0x") === 0. Actual: ' + (parseFloat("0x")));
17 }
18
19 //CHECK#2
20 if (parseFloat("11x") !== 11) {
21 $ERROR('#2: parseFloat("11x") === 11. Actual: ' + (parseFloat("11x")));
22 }
23
24 //CHECK#3
25 if (parseFloat("11s1") !== 11) {
26 $ERROR('#3: parseFloat("11s1") === 11. Actual: ' + (parseFloat("11s1")));
27 }
28
29 //CHECK#4
30 if (parseFloat("11.s1") !== 11) {
31 $ERROR('#4: parseFloat("11.s1") === 11. Actual: ' + (parseFloat("11.s1")));
32 }
33
34 //CHECK#5
35 if (parseFloat(".0s1") !== 0) {
36 $ERROR('#5: parseFloat(".0s1") === 0. Actual: ' + (parseFloat(".0s1")));
37 }
38
39 //CHECK#6
40 if (parseFloat("1.s1") !== 1) {
41 $ERROR('#6: parseFloat("1.s1") === 1. Actual: ' + (parseFloat("1.s1")));
42 }
43
44 //CHECK#7
45 if (parseFloat("1..1") !== 1) {
46 $ERROR('#7: parseFloat("1..1") === 1. Actual: ' + (parseFloat("1..1")));
47 }
48
49 //CHECK#8
50 if (parseFloat("0.1.1") !== 0.1) {
51 $ERROR('#8: parseFloat("0.1.1") === 0.1. Actual: ' + (parseFloat("0.1.1")));
52 }
53
54 //CHECK#9
55 if (parseFloat("0. 1") !== 0) {
56 $ERROR('#9: parseFloat("0. 1") === 0. Actual: ' + (parseFloat("0. 1")));
57 }