From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11490 invoked by alias); 3 Jan 2007 20:57:19 -0000 Received: (qmail 11478 invoked by uid 22791); 3 Jan 2007 20:57:18 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 Jan 2007 20:57:13 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l03KvB6K006357 for ; Wed, 3 Jan 2007 15:57:11 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l03KvBnf000418 for ; Wed, 3 Jan 2007 15:57:11 -0500 Received: from [172.16.14.87] (toddy.toronto.redhat.com [172.16.14.87]) by pobox.toronto.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l03KvAuO020602 for ; Wed, 3 Jan 2007 15:57:11 -0500 Message-ID: <459C18A6.3040105@redhat.com> Date: Wed, 03 Jan 2007 20:57:00 -0000 From: Francis Kung User-Agent: Thunderbird 1.5.0.9 (X11/20061219) MIME-Version: 1.0 To: mauve-patches Subject: FYI: Arrays.binarySearch tests Content-Type: multipart/mixed; boundary="------------090501020801070702070903" X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2007/txt/msg00003.txt.bz2 This is a multi-part message in MIME format. --------------090501020801070702070903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 412 Hi, This patch adds some checks to the binarySearch methods for the empty-array case. Cheers, Francis 2007-01-03 Francis Kung * gnu/testlet/java/util/Arrays/binarySearch.java: (testByte): Added check for empty array. (testChar): Likewise. (testDouble): Likewise. (testFloat): Likewise. (testInt): Likewise. (testLong): Likewise. (testObject): Likewise. (testShort): Likewise. --------------090501020801070702070903 Content-Type: text/x-patch; name="mauve-binarysearch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mauve-binarysearch.diff" Content-length: 2278 Index: gnu/testlet/java/util/Arrays/binarySearch.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Arrays/binarySearch.java,v retrieving revision 1.1 diff -u -r1.1 binarySearch.java --- gnu/testlet/java/util/Arrays/binarySearch.java 27 Aug 2004 21:57:50 -0000 1.1 +++ gnu/testlet/java/util/Arrays/binarySearch.java 3 Jan 2007 20:55:37 -0000 @@ -69,6 +69,9 @@ pass = true; } harness.check(pass); + + b1 = new byte[0]; + harness.check(Arrays.binarySearch(b1, (byte)0), -1); } private void testChar(TestHarness harness) @@ -91,6 +94,9 @@ pass = true; } harness.check(pass); + + b1 = new char[0]; + harness.check(Arrays.binarySearch(b1, '0'), -1); } private void testDouble(TestHarness harness) @@ -113,6 +119,9 @@ pass = true; } harness.check(pass); + + b1 = new double[0]; + harness.check(Arrays.binarySearch(b1, 0.0), -1); } private void testFloat(TestHarness harness) @@ -135,6 +144,9 @@ pass = true; } harness.check(pass); + + b1 = new float[0]; + harness.check(Arrays.binarySearch(b1, 0.0f), -1); } private void testInt(TestHarness harness) @@ -157,6 +169,9 @@ pass = true; } harness.check(pass); + + b1 = new int[0]; + harness.check(Arrays.binarySearch(b1, 0), -1); } private void testLong(TestHarness harness) @@ -179,6 +194,9 @@ pass = true; } harness.check(pass); + + b1 = new long[0]; + harness.check(Arrays.binarySearch(b1, 0), -1); } private void testObject(TestHarness harness) @@ -227,6 +245,9 @@ harness.check(Arrays.binarySearch(b1, "2", new ReverseComparator()) == 1); harness.check(Arrays.binarySearch(b1, "3", new ReverseComparator()) == 0); harness.check(Arrays.binarySearch(b1, "4", new ReverseComparator()) == -1); + + b1 = new Object[0]; + harness.check(Arrays.binarySearch(b1, ""), -1); } private void testShort(TestHarness harness) @@ -249,6 +270,9 @@ pass = true; } harness.check(pass); + + b1 = new short[0]; + harness.check(Arrays.binarySearch(b1, (short)0), -1); } static class ReverseComparator implements Comparator { --------------090501020801070702070903--