OLD | NEW |
(Empty) | |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 # |
| 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions |
| 6 # are met: |
| 7 # 1. Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. |
| 9 # 2. Redistributions in binary form must reproduce the above copyright |
| 10 # notice, this list of conditions and the following disclaimer in the |
| 11 # documentation and/or other materials provided with the distribution. |
| 12 # |
| 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY |
| 14 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 17 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 20 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 |
| 24 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. |
| 25 |
| 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
| 27 |
| 28 |
| 29 PASS (0).toFixed(0) is '0' |
| 30 PASS (0.49).toFixed(0) is '0' |
| 31 PASS (0.5).toFixed(0) is '1' |
| 32 PASS (0.51).toFixed(0) is '1' |
| 33 PASS (-0.49).toFixed(0) is '-0' |
| 34 PASS (-0.5).toFixed(0) is '-1' |
| 35 PASS (-0.51).toFixed(0) is '-1' |
| 36 PASS (0).toFixed(1) is '0.0' |
| 37 PASS (0.449).toFixed(1) is '0.4' |
| 38 PASS (0.45).toFixed(1) is '0.5' |
| 39 PASS (0.451).toFixed(1) is '0.5' |
| 40 PASS (0.5).toFixed(1) is '0.5' |
| 41 PASS (0.549).toFixed(1) is '0.5' |
| 42 PASS (0.55).toFixed(1) is '0.6' |
| 43 PASS (0.551).toFixed(1) is '0.6' |
| 44 PASS (-0.449).toFixed(1) is '-0.4' |
| 45 PASS (-0.45).toFixed(1) is '-0.5' |
| 46 PASS (-0.451).toFixed(1) is '-0.5' |
| 47 PASS (-0.5).toFixed(1) is '-0.5' |
| 48 PASS (-0.549).toFixed(1) is '-0.5' |
| 49 PASS (-0.55).toFixed(1) is '-0.6' |
| 50 PASS (-0.551).toFixed(1) is '-0.6' |
| 51 PASS (0.0).toFixed(4) is "0.0000" |
| 52 PASS (-0.0).toFixed(4) is "0.0000" |
| 53 PASS (0.0).toFixed() is "0" |
| 54 PASS (-0.0).toFixed() is "0" |
| 55 PASS (1234.567).toFixed() is "1235" |
| 56 PASS (1234.567).toFixed(0) is "1235" |
| 57 PASS (1234.567).toFixed(null) is "1235" |
| 58 PASS (1234.567).toFixed(false) is "1235" |
| 59 PASS (1234.567).toFixed('foo') is "1235" |
| 60 PASS (1234.567).toFixed(nan) is "1235" |
| 61 PASS (1234.567).toFixed(1) is "1234.6" |
| 62 PASS (1234.567).toFixed(true) is "1234.6" |
| 63 PASS (1234.567).toFixed('1') is "1234.6" |
| 64 PASS (1234.567).toFixed(2) is "1234.57" |
| 65 PASS (1234.567).toFixed(2.9) is "1234.57" |
| 66 PASS (1234.567).toFixed(5) is "1234.56700" |
| 67 PASS (1234.567).toFixed(20) is "1234.56700000000000727596" |
| 68 PASS (1234.567).toFixed(21) threw exception RangeError: toFixed() digits argumen
t must be between 0 and 20. |
| 69 PASS (1234.567).toFixed(100) threw exception RangeError: toFixed() digits argume
nt must be between 0 and 20. |
| 70 PASS (1234.567).toFixed(101) threw exception RangeError: toFixed() digits argume
nt must be between 0 and 20. |
| 71 PASS (1234.567).toFixed(-1) threw exception RangeError: toFixed() digits argumen
t must be between 0 and 20. |
| 72 PASS (1234.567).toFixed(-4) threw exception RangeError: toFixed() digits argumen
t must be between 0 and 20. |
| 73 PASS (1234.567).toFixed(-5) threw exception RangeError: toFixed() digits argumen
t must be between 0 and 20. |
| 74 PASS (1234.567).toFixed(-20) threw exception RangeError: toFixed() digits argume
nt must be between 0 and 20. |
| 75 PASS (1234.567).toFixed(-21) threw exception RangeError: toFixed() digits argume
nt must be between 0 and 20. |
| 76 PASS (1234.567).toFixed(posInf) threw exception RangeError: toFixed() digits arg
ument must be between 0 and 20. |
| 77 PASS (1234.567).toFixed(negInf) threw exception RangeError: toFixed() digits arg
ument must be between 0 and 20. |
| 78 PASS posInf.toFixed() is "Infinity" |
| 79 PASS negInf.toFixed() is "-Infinity" |
| 80 PASS nan.toFixed() is "NaN" |
| 81 PASS successfullyParsed is true |
| 82 |
| 83 TEST COMPLETE |
| 84 |
OLD | NEW |