From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15694 invoked by alias); 1 Sep 2008 23:03:49 -0000 Received: (qmail 15683 invoked by uid 22791); 1 Sep 2008 23:03:48 -0000 X-Spam-Check-By: sourceware.org Received: from smtp809.mail.ird.yahoo.com (HELO smtp809.mail.ird.yahoo.com) (217.146.188.69) by sourceware.org (qpsmtpd/0.31) with SMTP; Mon, 01 Sep 2008 23:02:41 +0000 Received: (qmail 75497 invoked from network); 1 Sep 2008 23:02:38 -0000 Received: from unknown (HELO orthanc.middle-earth.co.uk) (hughes2002@btinternet.com@86.149.18.213 with plain) by smtp809.mail.ird.yahoo.com with SMTP; 1 Sep 2008 23:02:37 -0000 X-YMail-OSG: yNyb1VIVM1mbcOoc2Xj_fGd6HL63zIep1nhngU3pF_lpGuwkiQnCiHPUjvRqmwrPfRC3Pz9WKJa3yZlOoKznWKWfX00CkXr2G2S81YfmZUKapniRusetLv0uqwzsF3vm_2I3YBEd_Bc67Pu6vgQ42lIR X-Yahoo-Newman-Property: ymail-3 Received: from rivendell.middle-earth.co.uk ([192.168.0.1]) by orthanc.middle-earth.co.uk with smtp (Exim 4.63) (envelope-from ) id 1KaIPs-0008Vo-2G for mauve-patches@sources.redhat.com; Tue, 02 Sep 2008 00:02:36 +0100 Received: by rivendell.middle-earth.co.uk (sSMTP sendmail emulation); Tue, 2 Sep 2008 00:02:35 +0100 Date: Mon, 01 Sep 2008 23:03:00 -0000 From: Andrew John Hughes To: mauve-patches@sources.redhat.com Subject: FYI: Fix BigDecimalInteger test and make exceptions cause failure Message-ID: <20080901230235.GA21257@rivendell.middle-earth.co.uk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) 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: 2008/txt/msg00062.txt.bz2 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 690 This patch amends another of the Scanner tests so it correctly uses harness.check (so we actually pass some tests). It also makes exceptions cause failure as they were being swallowed by the Base class. 2008-09-01 Andrew John Hughes * gnu/testlet/java/util/Scanner/Base.java: (test(TestHarness)): Fail if an exception is thrown. * gnu/testlet/java/util/Scanner/BigDecimalInteger.java: Use harness.check. -- Andrew :) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="scanner-02.diff" Content-length: 3313 Index: gnu/testlet/java/util/Scanner/Base.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Scanner/Base.java,v retrieving revision 1.1 diff -u -u -r1.1 Base.java --- gnu/testlet/java/util/Scanner/Base.java 1 Sep 2008 22:22:39 -0000 1.1 +++ gnu/testlet/java/util/Scanner/Base.java 1 Sep 2008 22:56:10 -0000 @@ -69,6 +69,7 @@ catch (Throwable e) { e.printStackTrace (); + myHarness.fail(e.toString()); } } Index: gnu/testlet/java/util/Scanner/BigDecimalInteger.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Scanner/BigDecimalInteger.java,v retrieving revision 1.1 diff -u -u -r1.1 BigDecimalInteger.java --- gnu/testlet/java/util/Scanner/BigDecimalInteger.java 1 Sep 2008 22:22:39 -0000 1.1 +++ gnu/testlet/java/util/Scanner/BigDecimalInteger.java 1 Sep 2008 22:56:11 -0000 @@ -69,72 +69,33 @@ { decimals[i] = new BigDecimal (rand.nextDouble () - 0.5); integers[i] = BigInteger.valueOf (rand.nextInt ()); -// if (i % 100 == 0) -// System.out.println(i); } sBuff.append (decimals[0] + " " + integers[0]); for (i = 1; i < decimals.length; i++) { sBuff.append (" " + decimals[i] + " " + integers[i]); -// if (i % 100 == 0) -// System.out.println(i); } inStr = sBuff.toString (); -// Scanner s = new Scanner (inStr); Scanner s = new Scanner (inStr); - //s.setUseLocale (false); -// System.out.println(inStr); - -// System.out.println("len : " + inStr.length()); i = 0; while (s.hasNext () && runsLeft > 0) { - fund = false; failed = false; - if (s.hasNextBigDecimal ()) - { - tmpDec = s.nextBigDecimal (); - if (!tmpDec.equals (decimals[i])) - { - failed = true; - this.myHarness.fail ("#" + i + - " : bad result by nextBigDeciaml() : (" + - tmpDec + " != " + decimals[i] + - ") possibly needed : \"" + s.next () + - "\""); - } - fund = true; - } - else - { - this.myHarness.fail ("no BigDecimal found..."); - } - if (s.hasNextBigInteger ()) - { - tmpInt = s.nextBigInteger (); - if (!tmpInt.equals (integers[i])) - { - failed = true; - this.myHarness.fail ("#" + i + - " : bad result by nextBigInteger() : " + - tmpInt + " != " + integers[i]); - } - fund = true; - } - else - { - this.myHarness.fail ("no BigInteger found..."); - } - -// if (i % 100 == 0) -// System.out.println(i); + fund = s.hasNextBigDecimal(); + myHarness.check(fund, "hasNextBigDecimal()"); + tmpDec = s.nextBigDecimal (); + myHarness.check(tmpDec, decimals[i], tmpDec + " == " + decimals[i]); + fund = s.hasNextBigInteger(); + myHarness.check(fund, "hasNextBigInteger()"); + tmpInt = s.nextBigInteger (); + myHarness.check(tmpInt, integers[i], tmpInt + " == " + integers[i]); if (!fund) { this.myHarness.fail ("\"" + s.next () + - "\" is neighter BigDecimal nor BigInteger"); + "\" is neither BigDecimal nor BigInteger"); } i++; if (failed) --h31gzZEtNLTqOjlF--