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
This commit is contained in:
Morgan James Delagrange 2002-02-26 06:17:51 +00:00
parent 205c1a3f34
commit 141176948f
8 changed files with 64 additions and 89 deletions

View File

@ -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;
}

View File

@ -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 <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @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();
}
}

View File

@ -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 <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @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();
}
}

View File

@ -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 <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @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");
}
}

View File

@ -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 <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
* @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

View File

@ -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);
}

View File

@ -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 <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @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();
}
}

View File

@ -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 <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @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;