Debian Codegraph @

js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T2.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: Return the number value for the MV of Result(4)
6 esid: sec-parsefloat-string
7 description: Checking DecimalDigits . DecimalDigits_opt ExponentPart_opt
8 ---*/
9
10 //CHECK#1
11 if (parseFloat("-11.") !== -11) {
12 throw new Test262Error('#1: parseFloat("-11.") === -11. Actual: ' + (parseFloat("-11.")));
13 }
14
15 //CHECK#2
16 if (parseFloat("01.") !== 1) {
17 throw new Test262Error('#2: parseFloat("01.") === 1. Actual: ' + (parseFloat("01.")));
18 }
19
20 //CHECK#3
21 if (parseFloat("+11.1") !== 11.1) {
22 throw new Test262Error('#3: parseFloat("+11.1") === 11.1. Actual: ' + (parseFloat("+11.1")));
23 }
24
25 //CHECK#4
26 if (parseFloat("01.1") !== 1.1) {
27 throw new Test262Error('#4: parseFloat("01.1") === 1.1. Actual: ' + (parseFloat("01.1")));
28 }
29
30 //CHECK#5
31 if (parseFloat("-11.e-1") !== -1.1) {
32 throw new Test262Error('#5: parseFloat("-11.e-1") === -1.1. Actual: ' + (parseFloat("-11.e-1")));
33 }
34
35 //CHECK#6
36 if (parseFloat("01.e1") !== 10) {
37 throw new Test262Error('#6: parseFloat("01.e1") === 10. Actual: ' + (parseFloat("01.e1")));
38 }
39
40 //CHECK#7
41 if (parseFloat("+11.22e-1") !== 1.122) {
42 throw new Test262Error('#7: parseFloat("+11.22e-1") === 1.122. Actual: ' + (parseFloat("+11.22e-1")));
43 }
44
45 //CHECK#8
46 if (parseFloat("01.01e1") !== 10.1) {
47 throw new Test262Error('#8: parseFloat("01.01e1") === 10.1. Actual: ' + (parseFloat("01.01e1")));
48 }
49
50 //CHECK#9
51 if (parseFloat("001.") !== 1) {
52 throw new Test262Error('#9: parseFloat("001.") === 1. Actual: ' + (parseFloat("001.")));
53 }
54
55 //CHECK#10
56 if (parseFloat("010.") !== 10) {
57 throw new Test262Error('#10: parseFloat("010.") === 10. Actual: ' + (parseFloat("010.")));
58 }
59
60 reportCompare(0, 0);