From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4026 invoked by alias); 23 Aug 2005 10:08:31 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 3369 invoked by uid 22791); 23 Aug 2005 10:07:51 -0000 Received: from outmail128170.authsmtp.co.uk (HELO squirrel.dmpriest.net.uk) (62.13.128.170) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 23 Aug 2005 10:07:51 +0000 Received: from [192.168.1.4] (host81-130-208-103.in-addr.btopenworld.com [81.130.208.103]) (authenticated bits=0) by squirrel.dmpriest.net.uk (8.13.3/8.13.3/Kp) with ESMTP id j7NA7nd0086820 for ; Tue, 23 Aug 2005 11:07:49 +0100 (BST) (envelope-from david.gilbert@object-refinery.com) Message-ID: <430B038C.10009@object-refinery.com> Date: Tue, 23 Aug 2005 10:08:00 -0000 From: David Gilbert User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050728) MIME-Version: 1.0 To: mauve-discuss@sources.redhat.com Subject: FYI: test for Vector.copyInto method Content-Type: multipart/mixed; boundary="------------000303060403000109020804" X-Server-Quench: c2998add-13bd-11da-a87f-001185d377ca X-Authentic-SMTP: 61633132333134.squirrel.dmpriest.net.uk:1.38/Kp X-Powered-By: AuthSMTP - http://www.authsmtp.com - Authenticated SMTP Mail Relay X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-SW-Source: 2005-q3/txt/msg00008.txt.bz2 This is a multi-part message in MIME format. --------------000303060403000109020804 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 176 I committed this new test: 2005-08-23 David Gilbert * gnu/testlet/java/util/Vector/copyInto.java: new test. Regards, Dave Gilbert --------------000303060403000109020804 Content-Type: text/plain; name="diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff.txt" Content-length: 2811 Index: gnu/testlet/java/util/Vector/copyInto.java =================================================================== RCS file: gnu/testlet/java/util/Vector/copyInto.java diff -N gnu/testlet/java/util/Vector/copyInto.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/java/util/Vector/copyInto.java 23 Aug 2005 10:03:37 -0000 @@ -0,0 +1,89 @@ +// Tags: JDK1.2 + +// Copyright (C) 2005 David Gilbert + +// This file is part of Mauve. + +// Mauve is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. + +// Mauve is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Mauve; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +package gnu.testlet.java.util.Vector; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.util.Vector; + +/** + * Some tests for the copyInto() method in the {@link Vector} class. + */ +public class copyInto implements Testlet +{ + + /** + * Runs the test using the specified harness. + * + * @param harness the test harness (null not permitted). + */ + public void test(TestHarness harness) + { + Vector v1 = new Vector(); + v1.add("A"); + v1.add("B"); + v1.add("C"); + Object[] array1 = new Object[3]; + v1.copyInto(array1); + harness.check(array1[0], "A"); + harness.check(array1[1], "B"); + harness.check(array1[2], "C"); + + // array longer than necessary + Object[] array2 = new Object[] {"1", "2", "3", "4"}; + v1.copyInto(array2); + harness.check(array2[0], "A"); + harness.check(array2[1], "B"); + harness.check(array2[2], "C"); + harness.check(array2[3], "4"); + + // array shorter than necessary + Object[] array3 = new Object[] {"1", "2"}; + boolean pass = false; + try + { + v1.copyInto(array3); + } + catch (IndexOutOfBoundsException e) + { + pass = true; + } + harness.check(pass); + harness.check(array3[0], "1"); // the method fails without modifying the + harness.check(array3[1], "2"); // array + + // try null array + pass = false; + try + { + v1.copyInto(null); + } + catch (NullPointerException e) + { + pass = true; + } + harness.check(pass); + + } + +} \ No newline at end of file --------------000303060403000109020804--