OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 18 matching lines...) Expand all Loading... |
29 assertEquals(0, parseInt(' 0')); | 29 assertEquals(0, parseInt(' 0')); |
30 assertEquals(0, parseInt(' 0 ')); | 30 assertEquals(0, parseInt(' 0 ')); |
31 | 31 |
32 assertEquals(63, parseInt('077')); | 32 assertEquals(63, parseInt('077')); |
33 assertEquals(63, parseInt(' 077')); | 33 assertEquals(63, parseInt(' 077')); |
34 assertEquals(63, parseInt(' 077 ')); | 34 assertEquals(63, parseInt(' 077 ')); |
35 assertEquals(-63, parseInt(' -077')); | 35 assertEquals(-63, parseInt(' -077')); |
36 | 36 |
37 assertEquals(3, parseInt('11', 2)); | 37 assertEquals(3, parseInt('11', 2)); |
38 assertEquals(4, parseInt('11', 3)); | 38 assertEquals(4, parseInt('11', 3)); |
| 39 assertEquals(4, parseInt('11', 3.8)); |
39 | 40 |
40 assertEquals(0x12, parseInt('0x12')); | 41 assertEquals(0x12, parseInt('0x12')); |
41 assertEquals(0x12, parseInt('0x12', 16)); | 42 assertEquals(0x12, parseInt('0x12', 16)); |
| 43 assertEquals(0x12, parseInt('0x12', 16.1)); |
| 44 assertEquals(0x12, parseInt('0x12', NaN)); |
42 | 45 |
43 assertEquals(12, parseInt('12aaa')); | 46 assertEquals(12, parseInt('12aaa')); |
44 | 47 |
45 assertEquals(0.1, parseFloat('0.1')); | 48 assertEquals(0.1, parseFloat('0.1')); |
46 assertEquals(0.1, parseFloat('0.1aaa')); | 49 assertEquals(0.1, parseFloat('0.1aaa')); |
47 assertEquals(0, parseFloat('0x12')); | 50 assertEquals(0, parseFloat('0x12')); |
48 assertEquals(77, parseFloat('077')); | 51 assertEquals(77, parseFloat('077')); |
49 | 52 |
50 | 53 |
51 var i; | 54 var i; |
(...skipping 21 matching lines...) Expand all Loading... |
73 | 76 |
74 assertTrue(isNaN(parseInt(0/0))); | 77 assertTrue(isNaN(parseInt(0/0))); |
75 assertTrue(isNaN(parseInt(1/0)), "parseInt Infinity"); | 78 assertTrue(isNaN(parseInt(1/0)), "parseInt Infinity"); |
76 assertTrue(isNaN(parseInt(-1/0)), "parseInt -Infinity"); | 79 assertTrue(isNaN(parseInt(-1/0)), "parseInt -Infinity"); |
77 | 80 |
78 assertTrue(isNaN(parseFloat(0/0))); | 81 assertTrue(isNaN(parseFloat(0/0))); |
79 assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity"); | 82 assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity"); |
80 assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity"); | 83 assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity"); |
81 | 84 |
82 | 85 |
OLD | NEW |