OLD | NEW |
| (Empty) |
1 This test checks a few Number.toFixed cases, including 5307: Number.toFixed does
not round 0.5 up and 5308: Number.toFixed does not include leading zero. | |
2 | |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
4 | |
5 | |
6 PASS (0).toFixed(0) is '0' | |
7 PASS (0.49).toFixed(0) is '0' | |
8 PASS (0.5).toFixed(0) is '1' | |
9 PASS (0.51).toFixed(0) is '1' | |
10 PASS (-0.49).toFixed(0) is '-0' | |
11 PASS (-0.5).toFixed(0) is '-1' | |
12 PASS (-0.51).toFixed(0) is '-1' | |
13 PASS (0).toFixed(1) is '0.0' | |
14 PASS (0.449).toFixed(1) is '0.4' | |
15 PASS (0.45).toFixed(1) is '0.5' | |
16 PASS (0.451).toFixed(1) is '0.5' | |
17 PASS (0.5).toFixed(1) is '0.5' | |
18 PASS (0.549).toFixed(1) is '0.5' | |
19 PASS (0.55).toFixed(1) is '0.6' | |
20 PASS (0.551).toFixed(1) is '0.6' | |
21 PASS (-0.449).toFixed(1) is '-0.4' | |
22 PASS (-0.45).toFixed(1) is '-0.5' | |
23 PASS (-0.451).toFixed(1) is '-0.5' | |
24 PASS (-0.5).toFixed(1) is '-0.5' | |
25 PASS (-0.549).toFixed(1) is '-0.5' | |
26 PASS (-0.55).toFixed(1) is '-0.6' | |
27 PASS (-0.551).toFixed(1) is '-0.6' | |
28 PASS (0.0).toFixed(4) is "0.0000" | |
29 PASS (-0.0).toFixed(4) is "0.0000" | |
30 PASS (0.0).toFixed() is "0" | |
31 PASS (-0.0).toFixed() is "0" | |
32 PASS (1234.567).toFixed() is "1235" | |
33 PASS (1234.567).toFixed(0) is "1235" | |
34 PASS (1234.567).toFixed(null) is "1235" | |
35 PASS (1234.567).toFixed(false) is "1235" | |
36 PASS (1234.567).toFixed('foo') is "1235" | |
37 PASS (1234.567).toFixed(nan) is "1235" | |
38 PASS (1234.567).toFixed(1) is "1234.6" | |
39 PASS (1234.567).toFixed(true) is "1234.6" | |
40 PASS (1234.567).toFixed('1') is "1234.6" | |
41 PASS (1234.567).toFixed(2) is "1234.57" | |
42 PASS (1234.567).toFixed(2.9) is "1234.57" | |
43 PASS (1234.567).toFixed(5) is "1234.56700" | |
44 PASS (1234.567).toFixed(20) is "1234.56700000000000727596" | |
45 PASS (1234.567).toFixed(21) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
46 PASS (1234.567).toFixed(100) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
47 PASS (1234.567).toFixed(101) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
48 PASS (1234.567).toFixed(-1) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
49 PASS (1234.567).toFixed(-4) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
50 PASS (1234.567).toFixed(-5) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
51 PASS (1234.567).toFixed(-20) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
52 PASS (1234.567).toFixed(-21) threw exception RangeError: toFixed() argument must
be between 0 and 20. | |
53 PASS (1234.567).toFixed(posInf) threw exception RangeError: toFixed() argument m
ust be between 0 and 20. | |
54 PASS (1234.567).toFixed(negInf) threw exception RangeError: toFixed() argument m
ust be between 0 and 20. | |
55 PASS posInf.toFixed() is "Infinity" | |
56 PASS negInf.toFixed() is "-Infinity" | |
57 PASS nan.toFixed() is "NaN" | |
58 PASS successfullyParsed is true | |
59 | |
60 TEST COMPLETE | |
61 | |
OLD | NEW |