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 Tests for Array.prototype.filter |
| 25 |
| 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
| 27 |
| 28 |
| 29 PASS [undefined].filter(passUndefined) is [undefined] |
| 30 PASS (new Array(20)).filter(passUndefined) is [] |
| 31 PASS [0,1,2,3,4,5,6,7,8,9].filter(passEven) is [0,2,4,6,8] |
| 32 PASS [0,1,2,3,4,5,6,7,8,9].filter(passAfter5) is [5,6,7,8,9] |
| 33 PASS mixPartialAndFast.filter(passAfter5) is [5,6,7,8,9,sparseArrayLength-1] |
| 34 PASS toObject([undefined]).filter(passUndefined) is [undefined] |
| 35 PASS toObject(new Array(20)).filter(passUndefined) is [] |
| 36 PASS toObject([0,1,2,3,4,5,6,7,8,9]).filter(passEven) is [0,2,4,6,8] |
| 37 PASS toObject([0,1,2,3,4,5,6,7,8,9]).filter(passAfter5) is [5,6,7,8,9] |
| 38 PASS toObject(mixPartialAndFast).filter(passAfter5) is [5,6,7,8,9,sparseArrayLen
gth-1] |
| 39 PASS reverseInsertionOrder([undefined]).filter(passUndefined) is [undefined] |
| 40 PASS reverseInsertionOrder(new Array(20)).filter(passUndefined) is [] |
| 41 PASS reverseInsertionOrder([0,1,2,3,4,5,6,7,8,9]).filter(passEven) is [0,2,4,6,8
] |
| 42 PASS reverseInsertionOrder([0,1,2,3,4,5,6,7,8,9]).filter(passAfter5) is [5,6,7,8
,9] |
| 43 PASS reverseInsertionOrder(mixPartialAndFast).filter(passAfter5) is [5,6,7,8,9,s
parseArrayLength-1] |
| 44 ,0,[object Object] |
| 45 PASS reverseInsertionOrder([undefined]).filter(filterLog(passUndefined)) is [und
efined] |
| 46 PASS reverseInsertionOrder(new Array(20)).filter(filterLog(passUndefined)) is [] |
| 47 0,0,[object Object] |
| 48 1,1,[object Object] |
| 49 2,2,[object Object] |
| 50 3,3,[object Object] |
| 51 4,4,[object Object] |
| 52 PASS reverseInsertionOrder([0,1,2,3,4]).filter(filterLog(passEven)) is [0,2,4] |
| 53 0,0,[object Object] |
| 54 1,1,[object Object] |
| 55 2,2,[object Object] |
| 56 3,3,[object Object] |
| 57 4,4,[object Object] |
| 58 5,5,[object Object] |
| 59 6,6,[object Object] |
| 60 7,7,[object Object] |
| 61 8,8,[object Object] |
| 62 9,9,[object Object] |
| 63 10099,10099,[object Object] |
| 64 PASS reverseInsertionOrder(mixPartialAndFast).filter(filterLog(passAfter5)) is [
5,6,7,8,9,sparseArrayLength-1] |
| 65 ,0, |
| 66 PASS ([undefined]).filter(filterLog(passUndefined)) is [undefined] |
| 67 PASS (new Array(20)).filter(filterLog(passUndefined)) is [] |
| 68 0,0,0,1,2,3,4 |
| 69 1,1,0,1,2,3,4 |
| 70 2,2,0,1,2,3,4 |
| 71 3,3,0,1,2,3,4 |
| 72 4,4,0,1,2,3,4 |
| 73 PASS ([0,1,2,3,4]).filter(filterLog(passEven)) is [0,2,4] |
| 74 0,0,0,1,2,3,4,5,6,7,8,9, |
| 75 1,1,0,1,2,3,4,5,6,7,8,9, |
| 76 2,2,0,1,2,3,4,5,6,7,8,9, |
| 77 3,3,0,1,2,3,4,5,6,7,8,9, |
| 78 4,4,0,1,2,3,4,5,6,7,8,9, |
| 79 5,5,0,1,2,3,4,5,6,7,8,9, |
| 80 6,6,0,1,2,3,4,5,6,7,8,9, |
| 81 7,7,0,1,2,3,4,5,6,7,8,9, |
| 82 8,8,0,1,2,3,4,5,6,7,8,9, |
| 83 9,9,0,1,2,3,4,5,6,7,8,9, |
| 84 10099,10099,0,1,2,3,4,5,6,7,8,9, |
| 85 PASS (mixPartialAndFast).filter(filterLog(passAfter5)) is [5,6,7,8,9,sparseArray
Length-1] |
| 86 PASS [1,2,3].filter(function(i,j,k,l,m){ return m=!m; }) is [1,2,3] |
| 87 PASS successfullyParsed is true |
| 88 |
| 89 TEST COMPLETE |
| 90 |
OLD | NEW |