From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31749 invoked by alias); 21 Aug 2007 23:04:52 -0000 Received: (qmail 31586 invoked by uid 22791); 21 Aug 2007 23:04:51 -0000 X-Spam-Check-By: sourceware.org Received: from smtp810.mail.ird.yahoo.com (HELO smtp810.mail.ird.yahoo.com) (217.146.188.70) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 21 Aug 2007 23:04:44 +0000 Received: (qmail 78097 invoked from network); 21 Aug 2007 23:04:41 -0000 Received: from unknown (HELO orthanc.middle-earth.co.uk) (hughes2002@btinternet.com@86.137.32.160 with plain) by smtp810.mail.ird.yahoo.com with SMTP; 21 Aug 2007 23:04:41 -0000 X-YMail-OSG: 3nP4oCYVM1klLb3AQGlGXTgw3YDfeERaYO174ubIZ4zcwhb44M7F2yiCmeQgoL7ozbNAZzXvNEA.2dv9RlmFXKq6UzKpnsm.7utIHAl01zTd5uC.adVtdQhXe4s- Received: from rivendell.middle-earth.co.uk ([192.168.0.1] helo=localhost.localdomain ident=gandalf) by orthanc.middle-earth.co.uk with smtp (Exim 4.63) (envelope-from ) id 1INcbB-0003gA-Qo for mauve-patches@sources.redhat.com; Tue, 21 Aug 2007 23:53:22 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Wed, 22 Aug 2007 00:04:39 +0100 From: "Andrew John Hughes" Date: Tue, 21 Aug 2007 23:04:00 -0000 To: mauve-patches@sources.redhat.com Subject: FYI: EnumSet test Message-ID: <20070821230439.GA2366@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qcHopEYAB45HaUaB" Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) 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/msg00054.txt.bz2 --qcHopEYAB45HaUaB Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 546 This adds a Mauve test for a bug in EnumSet I found today. The complementOf() function was failing as all bits (even those unused by the enumset) in the bit set were being flipped. ChangeLog: 2007-08-22 Andrew John Hughes * gnu/testlet/java/util/EnumSet/Colour.java: Test enumeration. * gnu/testlet/java/util/EnumSet/ComplementOf.java: New test. --=20 Andrew :-) Escape the Java Trap with GNU Classpath! http://www.gnu.org/philosophy/java-trap.html public class gcj extends Freedom implements Java { ... } --VbJkn9YxBvnuCH5J Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="util-01.diff" Content-length: 3628 Index: gnu/testlet/java/util/EnumSet/Colour.java =================================================================== RCS file: gnu/testlet/java/util/EnumSet/Colour.java diff -N gnu/testlet/java/util/EnumSet/Colour.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/java/util/EnumSet/Colour.java 21 Aug 2007 22:59:14 -0000 @@ -0,0 +1,38 @@ +// Tags: not-a-test + +// Copyright (C) 2007 Andrew John Hughes + +// 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.EnumSet; + +/** + * A test enumeration. + * + * @author Andrew John Hughes + */ +public enum Colour +{ + RED, + ORANGE, + YELLOW, + GREEN, + BLUE, + INDIGO, + VIOLET; +} Index: gnu/testlet/java/util/EnumSet/ComplementOf.java =================================================================== RCS file: gnu/testlet/java/util/EnumSet/ComplementOf.java diff -N gnu/testlet/java/util/EnumSet/ComplementOf.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/java/util/EnumSet/ComplementOf.java 21 Aug 2007 22:59:14 -0000 @@ -0,0 +1,52 @@ +// Tags: JDK1.5 + +// Copyright (C) 2007 Andrew John Hughes + +// 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.EnumSet; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.util.EnumSet; + +/** + * Tests the {@link java.util.EnumSet#complementOf(java.util.EnumSet)} + * method. + * + * @author Andrew John Hughes + */ +public class ComplementOf + implements Testlet +{ + + public void test(TestHarness h) + { + /* Inverse of empty set should be full set */ + EnumSet empty = EnumSet.noneOf(Colour.class); + h.debug("Empty: " + empty); + EnumSet full = EnumSet.complementOf(empty); + h.debug("Full: " + full); + h.check(full.size() == Colour.class.getEnumConstants().length, "Inverse of empty is full"); + EnumSet empty2 = EnumSet.complementOf(full); + h.debug("Empty2: " + empty2); + h.check(empty2.size() == 0, "Inverse of full is empty"); + h.check(empty.equals(empty2), "Inversing the inverse is same as original"); + } +} --VbJkn9YxBvnuCH5J-- --qcHopEYAB45HaUaB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline Content-length: 189 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGy2+HAQUyfTZIWfoRAhcpAJ9kttpX2/5ruEqMcoGC+/kveXfJqwCggQs3 u5/ybvwIqtuTpr/OAw/dYqw= =7W9/ -----END PGP SIGNATURE----- --qcHopEYAB45HaUaB--