| 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 26 matching lines...) Expand all Loading... |
| 37 num >>= 1; | 37 num >>= 1; |
| 38 } | 38 } |
| 39 | 39 |
| 40 return result; | 40 return result; |
| 41 } | 41 } |
| 42 | 42 |
| 43 assertEquals('0000000000', repeat('0', 10)); | 43 assertEquals('0000000000', repeat('0', 10)); |
| 44 | 44 |
| 45 // assertEquals(, toNumber()); | 45 // assertEquals(, toNumber()); |
| 46 | 46 |
| 47 assertEquals(1, 1.); |
| 48 assertEquals(1, toNumber("1.")); |
| 47 | 49 |
| 48 assertEquals(123, toNumber(" 123")); | 50 assertEquals(123, toNumber(" 123")); |
| 49 assertEquals(123, toNumber("\n123")); | 51 assertEquals(123, toNumber("\n123")); |
| 50 assertEquals(123, toNumber("\r123")); | 52 assertEquals(123, toNumber("\r123")); |
| 51 assertEquals(123, toNumber("\t123")); | 53 assertEquals(123, toNumber("\t123")); |
| 52 assertEquals(123, toNumber("\f123")); | 54 assertEquals(123, toNumber("\f123")); |
| 53 | 55 |
| 54 assertEquals(123, toNumber("123 ")); | 56 assertEquals(123, toNumber("123 ")); |
| 55 assertEquals(123, toNumber("123\n")); | 57 assertEquals(123, toNumber("123\n")); |
| 56 assertEquals(123, toNumber("123\r")); | 58 assertEquals(123, toNumber("123\r")); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 173 |
| 172 assertTrue(isNaN(toNumber("junk")), "junk"); | 174 assertTrue(isNaN(toNumber("junk")), "junk"); |
| 173 assertTrue(isNaN(toNumber("100 junk")), "100 junk"); | 175 assertTrue(isNaN(toNumber("100 junk")), "100 junk"); |
| 174 assertTrue(isNaN(toNumber("0x100 junk")), "0x100 junk"); | 176 assertTrue(isNaN(toNumber("0x100 junk")), "0x100 junk"); |
| 175 assertTrue(isNaN(toNumber("100.0 junk")), "100.0 junk"); | 177 assertTrue(isNaN(toNumber("100.0 junk")), "100.0 junk"); |
| 176 assertTrue(isNaN(toNumber(".1e4 junk")), ".1e4 junk"); | 178 assertTrue(isNaN(toNumber(".1e4 junk")), ".1e4 junk"); |
| 177 assertTrue(isNaN(toNumber("Infinity junk")), "Infinity junk"); | 179 assertTrue(isNaN(toNumber("Infinity junk")), "Infinity junk"); |
| 178 assertTrue(isNaN(toNumber("1e")), "1e"); | 180 assertTrue(isNaN(toNumber("1e")), "1e"); |
| 179 assertTrue(isNaN(toNumber("1e ")), "1e_"); | 181 assertTrue(isNaN(toNumber("1e ")), "1e_"); |
| 180 assertTrue(isNaN(toNumber("1" + repeat('0', 1000) + 'junk')), "1e1000 junk"); | 182 assertTrue(isNaN(toNumber("1" + repeat('0', 1000) + 'junk')), "1e1000 junk"); |
| OLD | NEW |