From 141176948fd644eace598e9a5ea705720212f7ba Mon Sep 17 00:00:00 2001 From: Morgan James Delagrange Date: Tue, 26 Feb 2002 06:17:51 +0000 Subject: [PATCH] merged in test changed from the HEAD into collections 1.x branch git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/branches/collections_1_x_branch@130593 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/collections/TestAll.java | 10 +++---- .../commons/collections/TestFastHashMap.java | 12 ++++---- .../commons/collections/TestFastTreeMap.java | 19 ++++++++---- .../commons/collections/TestHashMap.java | 27 ++++++++--------- .../commons/collections/TestLRUMap.java | 29 +++---------------- .../apache/commons/collections/TestMap.java | 18 ++++-------- .../collections/TestSoftRefHashMap.java | 12 ++++---- .../commons/collections/TestTreeMap.java | 26 ++++++++--------- 8 files changed, 64 insertions(+), 89 deletions(-) diff --git a/src/test/org/apache/commons/collections/TestAll.java b/src/test/org/apache/commons/collections/TestAll.java index 5c138e3d5..81385a9e0 100644 --- a/src/test/org/apache/commons/collections/TestAll.java +++ b/src/test/org/apache/commons/collections/TestAll.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.15.2.2 2002/02/26 05:44:14 morgand Exp $ - * $Revision: 1.15.2.2 $ - * $Date: 2002/02/26 05:44:14 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.15.2.3 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.15.2.3 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -66,7 +66,7 @@ import junit.framework.*; /** * Entry point for all Collections tests. * @author Rodney Waldhoff - * @version $Id: TestAll.java,v 1.15.2.2 2002/02/26 05:44:14 morgand Exp $ + * @version $Id: TestAll.java,v 1.15.2.3 2002/02/26 06:17:51 morgand Exp $ */ public class TestAll extends TestCase { public TestAll(String testName) { @@ -87,8 +87,6 @@ public class TestAll extends TestCase { suite.addTest(TestFastHashMap1.suite()); suite.addTest(TestFastTreeMap.suite()); suite.addTest(TestFastTreeMap1.suite()); - suite.addTest(TestHashMap.suite()); - suite.addTest(TestTreeMap.suite()); suite.addTest(TestLRUMap.suite()); return suite; } diff --git a/src/test/org/apache/commons/collections/TestFastHashMap.java b/src/test/org/apache/commons/collections/TestFastHashMap.java index 8241ee6e0..fc66754c0 100644 --- a/src/test/org/apache/commons/collections/TestFastHashMap.java +++ b/src/test/org/apache/commons/collections/TestFastHashMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2001/04/21 12:22:30 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v 1.3.2.1 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.3.2.1 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -69,7 +69,7 @@ import java.util.Map; /** * @author Jason van Zyl - * @version $Id: TestFastHashMap.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $ + * @version $Id: TestFastHashMap.java,v 1.3.2.1 2002/02/26 06:17:51 morgand Exp $ */ public class TestFastHashMap extends TestHashMap { @@ -89,7 +89,7 @@ public class TestFastHashMap extends TestHashMap junit.textui.TestRunner.main(testCaseName); } - public Map makeMap() { + public Map makeEmptyMap() { FastHashMap fhm = new FastHashMap(); fhm.setFast(false); return (fhm); @@ -97,7 +97,7 @@ public class TestFastHashMap extends TestHashMap public void setUp() { - map = (HashMap) makeMap(); + map = (HashMap) makeEmptyMap(); } } diff --git a/src/test/org/apache/commons/collections/TestFastTreeMap.java b/src/test/org/apache/commons/collections/TestFastTreeMap.java index 4313fc88e..fd95c420f 100644 --- a/src/test/org/apache/commons/collections/TestFastTreeMap.java +++ b/src/test/org/apache/commons/collections/TestFastTreeMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2001/04/21 12:22:30 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v 1.3.2.1 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.3.2.1 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -69,7 +69,7 @@ import java.util.TreeMap; /** * @author Jason van Zyl - * @version $Id: TestFastTreeMap.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $ + * @version $Id: TestFastTreeMap.java,v 1.3.2.1 2002/02/26 06:17:51 morgand Exp $ */ public class TestFastTreeMap extends TestTreeMap { @@ -89,15 +89,22 @@ public class TestFastTreeMap extends TestTreeMap junit.textui.TestRunner.main(testCaseName); } - public Map makeMap() { + public Map makeEmptyMap() { FastTreeMap ftm = new FastTreeMap(); ftm.setFast(false); return (ftm); } + + /** + * The comparator for the fast tree map does not support null keys. + **/ + public boolean useNullKey() { + return false; + } public void setUp() { - map = (TreeMap) makeMap(); + map = (TreeMap) makeEmptyMap(); } } diff --git a/src/test/org/apache/commons/collections/TestHashMap.java b/src/test/org/apache/commons/collections/TestHashMap.java index c28f788f1..5e0c56964 100644 --- a/src/test/org/apache/commons/collections/TestHashMap.java +++ b/src/test/org/apache/commons/collections/TestHashMap.java @@ -1,7 +1,13 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestHashMap.java,v 1.2.2.1 2002/02/26 00:51:21 morgand Exp $ - * $Revision: 1.2.2.1 $ - * $Date: 2002/02/26 00:51:21 $ +<<<<<<< TestHashMap.java + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestHashMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.2.2.2 $ + * $Date: 2002/02/26 06:17:51 $ +======= + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestHashMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.2.2.2 $ + * $Date: 2002/02/26 06:17:51 $ +>>>>>>> 1.6 * * ==================================================================== * @@ -69,31 +75,21 @@ import java.util.Map; /** * @author Jason van Zyl - * @version $Id: TestHashMap.java,v 1.2.2.1 2002/02/26 00:51:21 morgand Exp $ + * @version $Id: TestHashMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ */ -public class TestHashMap extends TestMap +public abstract class TestHashMap extends TestMap { public TestHashMap(String testName) { super(testName); } - public static Test suite() - { - return new TestSuite(TestHashMap.class); - } - public static void main(String args[]) { String[] testCaseName = { TestHashMap.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - public Map makeEmptyMap() { - HashMap hm = new HashMap(); - return (hm); - } - protected HashMap map = null; public void setUp() @@ -114,4 +110,5 @@ public class TestHashMap extends TestMap assertEquals("Top item is 'Second Item'", map.get("first"), "First Item"); assertEquals("Next Item is 'First Item'", map.get("second"), "Second Item"); } + } diff --git a/src/test/org/apache/commons/collections/TestLRUMap.java b/src/test/org/apache/commons/collections/TestLRUMap.java index 091252b03..3b022da95 100644 --- a/src/test/org/apache/commons/collections/TestLRUMap.java +++ b/src/test/org/apache/commons/collections/TestLRUMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.11.2.1 2002/02/26 00:51:21 morgand Exp $ - * $Revision: 1.11.2.1 $ - * $Date: 2002/02/26 00:51:21 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.11.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.11.2.2 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -76,7 +76,7 @@ import java.util.HashMap; * * @author James Strachan * @author Morgan Delagrange - * @version $Id: TestLRUMap.java,v 1.11.2.1 2002/02/26 00:51:21 morgand Exp $ + * @version $Id: TestLRUMap.java,v 1.11.2.2 2002/02/26 06:17:51 morgand Exp $ */ public class TestLRUMap extends TestMap { @@ -190,27 +190,6 @@ public class TestLRUMap extends TestMap map.size() == 3); } - - public void testExternalizable() throws IOException, ClassNotFoundException { - /* - * Test object created with this code - * Object created from CVS version 1.3 of the LRUMap class - * - LRUMap map2 = new LRUMap(3); - map2.put(new Integer(1),"foo"); - map2.put(new Integer(4),"bar"); - map2.put(new Integer(6),"yeah"); - map2.writeExternal(new ObjectOutputStream(new FileOutputStream("data/test/LRUMapVersion1.obj"))); - */ - - // purposely start me out with a smaller capacity - LRUMap map2 = new LRUMap(1); - map2.readExternal(new ObjectInputStream(new FileInputStream("data/test/LRUMapVersion1.obj"))); - assertTrue("Integer(1) equals foo",map2.get(new Integer(1)).equals("foo")); - assertTrue("Integer(4) equals bar",map2.get(new Integer(4)).equals("bar")); - assertTrue("Integer(6) equals yeah",map2.get(new Integer(6)).equals("yeah")); - } - /** * You should be able to subclass LRUMap and perform a * custom action when items are removed automatically diff --git a/src/test/org/apache/commons/collections/TestMap.java b/src/test/org/apache/commons/collections/TestMap.java index 0261d3f10..58478988a 100644 --- a/src/test/org/apache/commons/collections/TestMap.java +++ b/src/test/org/apache/commons/collections/TestMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.3.2.1 2002/02/26 00:51:21 morgand Exp $ - * $Revision: 1.3.2.1 $ - * $Date: 2002/02/26 00:51:21 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.3.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.3.2.2 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -87,7 +87,7 @@ import java.util.NoSuchElementException; * * @author Michael Smith * @author Rodney Waldhoff - * @version $Id: TestMap.java,v 1.3.2.1 2002/02/26 00:51:21 morgand Exp $ + * @version $Id: TestMap.java,v 1.3.2.2 2002/02/26 06:17:51 morgand Exp $ */ public abstract class TestMap extends TestObject { @@ -959,17 +959,14 @@ public abstract class TestMap extends TestObject { * against the canonical version in CVS. */ public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException { - /** - * Create canonical objects with this code Map map = makeEmptyMap(); if (!(map instanceof Serializable)) return; writeExternalFormToDisk((Serializable) map, getCanonicalEmptyMapName(map)); - */ // test to make sure the canonical form has been preserved if (!(makeEmptyMap() instanceof Serializable)) return; - Map map = (Map) readExternalFormFromDisk(getCanonicalEmptyMapName(makeEmptyMap())); + map = (Map) readExternalFormFromDisk(getCanonicalEmptyMapName(makeEmptyMap())); assertTrue("Map is empty",map.isEmpty() == true); } @@ -978,17 +975,14 @@ public abstract class TestMap extends TestObject { * against the canonical version in CVS. */ public void testFullMapCompatibility() throws IOException, ClassNotFoundException { - /** - * Create canonical objects with this code Map map = makeFullMap(); if (!(map instanceof Serializable)) return; writeExternalFormToDisk((Serializable) map, getCanonicalFullMapName(map)); - */ // test to make sure the canonical form has been preserved if (!(makeFullMap() instanceof Serializable)) return; - Map map = (Map) readExternalFormFromDisk(getCanonicalFullMapName(makeFullMap())); + map = (Map) readExternalFormFromDisk(getCanonicalFullMapName(makeFullMap())); assertEquals("Map is the right size",map.size(), getSampleKeys().length); } diff --git a/src/test/org/apache/commons/collections/TestSoftRefHashMap.java b/src/test/org/apache/commons/collections/TestSoftRefHashMap.java index bae4fa15e..ccb19a5f7 100644 --- a/src/test/org/apache/commons/collections/TestSoftRefHashMap.java +++ b/src/test/org/apache/commons/collections/TestSoftRefHashMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestSoftRefHashMap.java,v 1.1 2001/05/06 11:10:36 jstrachan Exp $ - * $Revision: 1.1 $ - * $Date: 2001/05/06 11:10:36 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestSoftRefHashMap.java,v 1.1.2.1 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.1.2.1 $ + * $Date: 2002/02/26 06:17:51 $ * * ==================================================================== * @@ -69,7 +69,7 @@ import java.util.HashMap; /** * @author James Strachan - * @version $Id: TestSoftRefHashMap.java,v 1.1 2001/05/06 11:10:36 jstrachan Exp $ + * @version $Id: TestSoftRefHashMap.java,v 1.1.2.1 2002/02/26 06:17:51 morgand Exp $ */ public class TestSoftRefHashMap extends TestHashMap { @@ -86,13 +86,13 @@ public class TestSoftRefHashMap extends TestHashMap junit.textui.TestRunner.main(testCaseName); } - public Map makeMap() { + public Map makeEmptyMap() { SoftRefHashMap map = new SoftRefHashMap(); return map; } public void setUp() { - map = (HashMap) makeMap(); + map = (HashMap) makeEmptyMap(); } } diff --git a/src/test/org/apache/commons/collections/TestTreeMap.java b/src/test/org/apache/commons/collections/TestTreeMap.java index ab8d6bfb3..d85211b59 100644 --- a/src/test/org/apache/commons/collections/TestTreeMap.java +++ b/src/test/org/apache/commons/collections/TestTreeMap.java @@ -1,7 +1,13 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeMap.java,v 1.2.2.1 2002/02/26 00:51:21 morgand Exp $ - * $Revision: 1.2.2.1 $ - * $Date: 2002/02/26 00:51:21 $ +<<<<<<< TestTreeMap.java + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.2.2.2 $ + * $Date: 2002/02/26 06:17:51 $ +======= + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ + * $Revision: 1.2.2.2 $ + * $Date: 2002/02/26 06:17:51 $ +>>>>>>> 1.5 * * ==================================================================== * @@ -69,29 +75,23 @@ import java.util.Map; /** * @author Jason van Zyl - * @version $Id: TestTreeMap.java,v 1.2.2.1 2002/02/26 00:51:21 morgand Exp $ + * @version $Id: TestTreeMap.java,v 1.2.2.2 2002/02/26 06:17:51 morgand Exp $ */ -public class TestTreeMap extends TestMap +public abstract class TestTreeMap extends TestMap { public TestTreeMap(String testName) { super(testName); } - public static Test suite() - { - return new TestSuite(TestTreeMap.class); - } - public static void main(String args[]) { String[] testCaseName = { TestTreeMap.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - public Map makeEmptyMap() { - TreeMap tm = new TreeMap(); - return (tm); + public boolean useNullKey() { + return false; } protected TreeMap map = null;