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 24Tests for Array.prototype.filter 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS [undefined].filter(passUndefined) is [undefined] 30PASS (new Array(20)).filter(passUndefined) is [] 31PASS [0,1,2,3,4,5,6,7,8,9].filter(passEven) is [0,2,4,6,8] 32PASS [0,1,2,3,4,5,6,7,8,9].filter(passAfter5) is [5,6,7,8,9] 33PASS mixPartialAndFast.filter(passAfter5) is [5,6,7,8,9,sparseArrayLength-1] 34PASS toObject([undefined]).filter(passUndefined) is [undefined] 35PASS toObject(new Array(20)).filter(passUndefined) is [] 36PASS toObject([0,1,2,3,4,5,6,7,8,9]).filter(passEven) is [0,2,4,6,8] 37PASS toObject([0,1,2,3,4,5,6,7,8,9]).filter(passAfter5) is [5,6,7,8,9] 38PASS toObject(mixPartialAndFast).filter(passAfter5) is [5,6,7,8,9,sparseArrayLength-1] 39PASS reverseInsertionOrder([undefined]).filter(passUndefined) is [undefined] 40PASS reverseInsertionOrder(new Array(20)).filter(passUndefined) is [] 41PASS reverseInsertionOrder([0,1,2,3,4,5,6,7,8,9]).filter(passEven) is [0,2,4,6,8] 42PASS reverseInsertionOrder([0,1,2,3,4,5,6,7,8,9]).filter(passAfter5) is [5,6,7,8,9] 43PASS reverseInsertionOrder(mixPartialAndFast).filter(passAfter5) is [5,6,7,8,9,sparseArrayLength-1] 44,0,[object Object] 45PASS reverseInsertionOrder([undefined]).filter(filterLog(passUndefined)) is [undefined] 46PASS reverseInsertionOrder(new Array(20)).filter(filterLog(passUndefined)) is [] 470,0,[object Object] 481,1,[object Object] 492,2,[object Object] 503,3,[object Object] 514,4,[object Object] 52PASS reverseInsertionOrder([0,1,2,3,4]).filter(filterLog(passEven)) is [0,2,4] 530,0,[object Object] 541,1,[object Object] 552,2,[object Object] 563,3,[object Object] 574,4,[object Object] 585,5,[object Object] 596,6,[object Object] 607,7,[object Object] 618,8,[object Object] 629,9,[object Object] 6310099,10099,[object Object] 64PASS reverseInsertionOrder(mixPartialAndFast).filter(filterLog(passAfter5)) is [5,6,7,8,9,sparseArrayLength-1] 65,0, 66PASS ([undefined]).filter(filterLog(passUndefined)) is [undefined] 67PASS (new Array(20)).filter(filterLog(passUndefined)) is [] 680,0,0,1,2,3,4 691,1,0,1,2,3,4 702,2,0,1,2,3,4 713,3,0,1,2,3,4 724,4,0,1,2,3,4 73PASS ([0,1,2,3,4]).filter(filterLog(passEven)) is [0,2,4] 740,0,0,1,2,3,4,5,6,7,8,9, 751,1,0,1,2,3,4,5,6,7,8,9, 762,2,0,1,2,3,4,5,6,7,8,9, 773,3,0,1,2,3,4,5,6,7,8,9, 784,4,0,1,2,3,4,5,6,7,8,9, 795,5,0,1,2,3,4,5,6,7,8,9, 806,6,0,1,2,3,4,5,6,7,8,9, 817,7,0,1,2,3,4,5,6,7,8,9, 828,8,0,1,2,3,4,5,6,7,8,9, 839,9,0,1,2,3,4,5,6,7,8,9, 8410099,10099,0,1,2,3,4,5,6,7,8,9, 85PASS (mixPartialAndFast).filter(filterLog(passAfter5)) is [5,6,7,8,9,sparseArrayLength-1] 86PASS [1,2,3].filter(function(i,j,k,l,m){ return m=!m; }) is [1,2,3] 87PASS successfullyParsed is true 88 89TEST COMPLETE 90 91