Additional testing of new maps
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cfb3754d15
commit
4f699c8628
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestHashedMap.java,v 1.2 2003/12/02 23:51:49 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestHashedMap.java,v 1.3 2003/12/07 01:22:50 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/02 23:51:49 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/07 01:22:50 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -93,4 +93,10 @@ public class TestHashedMap extends AbstractTestIterableMap {
|
|||
return "3";
|
||||
}
|
||||
|
||||
// public void testCreate() throws Exception {
|
||||
// resetEmpty();
|
||||
// writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj");
|
||||
// resetFull();
|
||||
// writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj");
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java,v 1.2 2003/12/02 23:51:49 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java,v 1.3 2003/12/07 01:22:50 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -64,13 +64,13 @@ import junit.framework.Test;
|
|||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import org.apache.commons.collections.IterableMap;
|
||||
import org.apache.commons.collections.AbstractTestObject;
|
||||
import org.apache.commons.collections.IterableMap;
|
||||
|
||||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/02 23:51:49 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/07 01:22:50 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -152,4 +152,13 @@ public class TestIdentityMap extends AbstractTestObject {
|
|||
assertEquals(false, entry1.equals(entry3));
|
||||
}
|
||||
|
||||
// public void testCreate() throws Exception {
|
||||
// Map map = new IdentityMap();
|
||||
// writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/IdentityMap.emptyCollection.version3.obj");
|
||||
// map = new IdentityMap();
|
||||
// map.put(I1A, I2A);
|
||||
// map.put(I1B, I2A);
|
||||
// map.put(I2A, I2B);
|
||||
// writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/IdentityMap.fullCollection.version3.obj");
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java,v 1.1 2003/12/03 19:04:41 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java,v 1.2 2003/12/07 01:22:50 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -58,6 +58,7 @@
|
|||
package org.apache.commons.collections.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -71,7 +72,7 @@ import org.apache.commons.collections.ResettableIterator;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/12/03 19:04:41 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/07 01:22:50 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -113,6 +114,51 @@ public class TestLinkedMap extends AbstractTestOrderedMap {
|
|||
assertSame(list.get(0), it.next());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testInsertionOrder() {
|
||||
if (isPutAddSupported() == false || isPutChangeSupported() == false) return;
|
||||
Object[] keys = getSampleKeys();
|
||||
Object[] values = getSampleValues();
|
||||
Iterator it = null;
|
||||
|
||||
resetEmpty();
|
||||
map.put(keys[0], values[0]);
|
||||
map.put(keys[1], values[1]);
|
||||
it = map.keySet().iterator();
|
||||
assertSame(keys[0], it.next());
|
||||
assertSame(keys[1], it.next());
|
||||
it = map.values().iterator();
|
||||
assertSame(values[0], it.next());
|
||||
assertSame(values[1], it.next());
|
||||
|
||||
// no change to order
|
||||
map.put(keys[1], values[1]);
|
||||
it = map.keySet().iterator();
|
||||
assertSame(keys[0], it.next());
|
||||
assertSame(keys[1], it.next());
|
||||
it = map.values().iterator();
|
||||
assertSame(values[0], it.next());
|
||||
assertSame(values[1], it.next());
|
||||
|
||||
// no change to order
|
||||
map.put(keys[1], values[2]);
|
||||
it = map.keySet().iterator();
|
||||
assertSame(keys[0], it.next());
|
||||
assertSame(keys[1], it.next());
|
||||
it = map.values().iterator();
|
||||
assertSame(values[0], it.next());
|
||||
assertSame(values[2], it.next());
|
||||
|
||||
// no change to order
|
||||
map.put(keys[0], values[3]);
|
||||
it = map.keySet().iterator();
|
||||
assertSame(keys[0], it.next());
|
||||
assertSame(keys[1], it.next());
|
||||
it = map.values().iterator();
|
||||
assertSame(values[3], it.next());
|
||||
assertSame(values[2], it.next());
|
||||
}
|
||||
|
||||
// public void testCreate() throws Exception {
|
||||
// resetEmpty();
|
||||
// writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/LinkedMap.emptyCollection.version3.obj");
|
||||
|
|
Loading…
Reference in New Issue