From 9752389b61ba5e615ed04bee77e98f0ed27b3958 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 21 Jun 2002 04:01:31 +0000 Subject: [PATCH] Made the TestCases for primitive lists extend TestList, so the full suite of List tests is performed on them. Used BulkTest.makeSuite to pick up the sublist tests. There should probably be additional work for testing the primitive operations. Submitted by: Paul Jack ( pjack at sfaf dot org ) git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130735 13f79535-47bb-0310-9956-ffa450edef68 --- .../primitives/TestAbstractIntArrayList.java | 61 ++++++++++++++++-- .../primitives/TestAbstractLongArrayList.java | 62 ++++++++++++++++-- .../TestAbstractShortArrayList.java | 63 +++++++++++++++++-- .../primitives/TestFloatArrayList.java | 54 ++++++++++++++-- .../primitives/TestIntArrayList.java | 11 ++-- .../primitives/TestLongArrayList.java | 11 ++-- .../primitives/TestShortArrayList.java | 11 ++-- .../primitives/TestUnsignedByteArrayList.java | 11 ++-- .../primitives/TestUnsignedIntArrayList.java | 11 ++-- .../TestUnsignedShortArrayList.java | 11 ++-- 10 files changed, 255 insertions(+), 51 deletions(-) diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java index 5b19465d4..30cc6bbfc 100644 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractIntArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -68,10 +68,10 @@ import org.apache.commons.collections.TestList; import java.util.List; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ -public abstract class TestAbstractIntArrayList extends /* TestList */ TestCase { +public abstract class TestAbstractIntArrayList extends TestList { //------------------------------------------------------------ Conventional @@ -130,5 +130,56 @@ public abstract class TestAbstractIntArrayList extends /* TestList */ TestCase { assertEquals("Should get entry back", i, list.getInt(i)); } } + + + /** + * Returns small Integer objects for testing. + */ + protected Object[] getFullElements() { + Integer[] result = new Integer[19]; + for (int i = 0; i < result.length; i++) { + result[i] = new Integer(i + 19); + } + return result; + } + + + /** + * Returns small Integer objects for testing. + */ + protected Object[] getOtherElements() { + Integer[] result = new Integer[16]; + for (int i = 0; i < result.length; i++) { + result[i] = new Integer(i + 48); + } + return result; + } + + // TODO: Create canonical collections in CVS + + public void testCanonicalEmptyCollectionExists() { + } + + + public void testCanonicalFullCollectionExists() { + } + + public void testEmptyListCompatibility() { + } + + public void testFullListCompatibility() { + } + + // TODO: Fix primitive lists to be fail fast + + public void testCollectionIteratorFailFast() { + } + + public void testListSubListFailFastOnAdd() { + } + + public void testListSubListFailFastOnRemove() { + } + } diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java index 0e9e0218a..d8490d6cb 100644 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractLongArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractLongArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -68,10 +68,10 @@ import org.apache.commons.collections.TestList; import java.util.List; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ -public abstract class TestAbstractLongArrayList extends /* TestList */ TestCase { +public abstract class TestAbstractLongArrayList extends TestList { //------------------------------------------------------------ Conventional @@ -115,5 +115,57 @@ public abstract class TestAbstractLongArrayList extends /* TestList */ TestCase } } + + /** + * Returns an array of Long objects for testing. + */ + protected Object[] getFullElements() { + Long[] result = new Long[19]; + for (int i = 0; i < result.length; i++) { + result[i] = new Long(i + 19); + } + return result; + } + + + /** + * Returns an array of Long objects for testing. + */ + protected Object[] getOtherElements() { + Long[] result = new Long[16]; + for (int i = 0; i < result.length; i++) { + result[i] = new Long(i + 48); + } + return result; + } + + // TODO: Create canonical primitive lists in CVS + + public void testCanonicalEmptyCollectionExists() { + } + + + public void testCanonicalFullCollectionExists() { + } + + public void testEmptyListCompatibility() { + } + + public void testFullListCompatibility() { + } + + // TODO: Make primitive lists fail-fast + + public void testCollectionIteratorFailFast() { + } + + public void testListSubListFailFastOnAdd() { + } + + public void testListSubListFailFastOnRemove() { + } + + + } diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java index 8b255ac4a..15dfbc166 100644 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractShortArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -68,10 +68,10 @@ import org.apache.commons.collections.TestList; import java.util.List; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ -public abstract class TestAbstractShortArrayList extends /* TestList */ TestCase { +public abstract class TestAbstractShortArrayList extends TestList { //------------------------------------------------------------ Conventional @@ -110,5 +110,58 @@ public abstract class TestAbstractShortArrayList extends /* TestList */ TestCase assertEquals((short)(i+128),list.getShort(i)); } } + + /** + * Returns an array of Short objects for testing. + */ + protected Object[] getFullElements() { + Short[] result = new Short[19]; + for (int i = 0; i < result.length; i++) { + result[i] = new Short((short)(i + 19)); + } + return result; + } + + + /** + * Returns an array of Short objects for testing. + */ + protected Object[] getOtherElements() { + Short[] result = new Short[16]; + for (int i = 0; i < result.length; i++) { + result[i] = new Short((short)(i + 48)); + } + return result; + } + + // TODO: Create canonical primitive lists in CVS + + public void testCanonicalEmptyCollectionExists() { + } + + + public void testCanonicalFullCollectionExists() { + } + + public void testEmptyListCompatibility() { + } + + public void testFullListCompatibility() { + } + + // TODO: Make primitive lists fail fast + + public void testCollectionIteratorFailFast() { + } + + public void testListSubListFailFastOnAdd() { + } + + public void testListSubListFailFastOnRemove() { + } + + + + } diff --git a/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java b/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java index f7c834df3..84b2abdc4 100644 --- a/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatArrayList.java,v 1.1 2002/06/04 16:50:09 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:50:09 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -68,10 +68,10 @@ import org.apache.commons.collections.TestList; import java.util.List; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:50:09 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ -public class TestFloatArrayList extends /* TestList */ TestCase { +public class TestFloatArrayList extends TestList { //------------------------------------------------------------ Conventional @@ -80,7 +80,7 @@ public class TestFloatArrayList extends /* TestList */ TestCase { } public static Test suite() { - TestSuite suite = new TestSuite(TestFloatArrayList.class); + TestSuite suite = TestList.makeSuite(TestFloatArrayList.class); return suite; } @@ -107,5 +107,47 @@ public class TestFloatArrayList extends /* TestList */ TestCase { assertEquals((float)i,list.getFloat(i),Float.MAX_VALUE); } } + + + protected Object[] getFullElements() { + Float[] result = new Float[19]; + for (int i = 0; i < result.length; i++) { + result[i] = new Float((float)(i + 19)); + } + return result; + } + + + protected Object[] getOtherElements() { + Float[] result = new Float[16]; + for (int i = 0; i < result.length; i++) { + result[i] = new Float((float)(i + 48)); + } + return result; + } + + + public void testCanonicalEmptyCollectionExists() { + } + + + public void testCanonicalFullCollectionExists() { + } + + public void testEmptyListCompatibility() { + } + + public void testFullListCompatibility() { + } + + public void testCollectionIteratorFailFast() { + } + + public void testListSubListFailFastOnAdd() { + } + + public void testListSubListFailFastOnRemove() { + } + } diff --git a/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java b/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java index 32f69a441..7e5631fd3 100644 --- a/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestIntArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestIntArrayList extends TestAbstractIntArrayList { @@ -78,7 +79,7 @@ public class TestIntArrayList extends TestAbstractIntArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestIntArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestIntArrayList.class); return suite; } diff --git a/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java b/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java index 395d705c2..1f6b119d6 100644 --- a/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestLongArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestLongArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestLongArrayList extends TestAbstractLongArrayList { @@ -78,7 +79,7 @@ public class TestLongArrayList extends TestAbstractLongArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestLongArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestLongArrayList.class); return suite; } diff --git a/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java b/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java index 867bde0f2..1281983bf 100644 --- a/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestShortArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestShortArrayList extends TestAbstractShortArrayList { @@ -78,7 +79,7 @@ public class TestShortArrayList extends TestAbstractShortArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestShortArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestShortArrayList.class); return suite; } diff --git a/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java b/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java index 813c62aa2..565f3ec5c 100644 --- a/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedByteArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedByteArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestUnsignedByteArrayList extends TestAbstractShortArrayList { @@ -78,7 +79,7 @@ public class TestUnsignedByteArrayList extends TestAbstractShortArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestUnsignedByteArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestUnsignedByteArrayList.class); return suite; } diff --git a/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java b/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java index 49b06a5bf..1b6e000ed 100644 --- a/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedIntArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestUnsignedIntArrayList extends TestAbstractLongArrayList { @@ -78,7 +79,7 @@ public class TestUnsignedIntArrayList extends TestAbstractLongArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestUnsignedIntArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestUnsignedIntArrayList.class); return suite; } diff --git a/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java b/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java index 46c587cfc..c4ef8fdd4 100644 --- a/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java +++ b/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ - * $Revision: 1.1 $ - * $Date: 2002/06/04 16:01:28 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedShortArrayList.java,v 1.2 2002/06/21 04:01:31 mas Exp $ + * $Revision: 1.2 $ + * $Date: 2002/06/21 04:01:31 $ * * ==================================================================== * @@ -64,9 +64,10 @@ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.collections.BulkTest; /** - * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ + * @version $Revision: 1.2 $ $Date: 2002/06/21 04:01:31 $ * @author Rodney Waldhoff */ public class TestUnsignedShortArrayList extends TestAbstractIntArrayList { @@ -78,7 +79,7 @@ public class TestUnsignedShortArrayList extends TestAbstractIntArrayList { } public static Test suite() { - TestSuite suite = new TestSuite(TestUnsignedShortArrayList.class); + TestSuite suite = BulkTest.makeSuite(TestUnsignedShortArrayList.class); return suite; }