Просмотр исходного кода

test (86)
pom.xml - profile for "recent coverage"

Ranides Atterwim 10 лет назад
Родитель
Сommit
34a556b86b

+ 117 - 0
assira/pom.xml

@@ -11,7 +11,124 @@
     <artifactId>assira</artifactId>
     <version>2.0.0</version>
     <packaging>jar</packaging>
+    
+    <profiles>
+        <profile>
+            <id>recent-coverage</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.jacoco</groupId>
+                        <artifactId>jacoco-maven-plugin</artifactId>
+                        <version>0.7.5.201505241946</version>
+                        <configuration>
+                            <excludes>
+                                <!-- 
+                                    Klasy dostatecznie przetestowane. Ignorowane, ponieważ
+                                    zmniejszają czytelność "bieżącego" raportu.
+                                -->
+
+                                <exclude>net/ranides/assira/collection/maps/AMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AIntMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AIntMap$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/maps/ASortedMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/ASortedMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AIntSortedMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AIntSortedMap$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/maps/AHashMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AHashMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/HashMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/HashMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntHashMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntHashMap$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/maps/AVLTreeMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/AVLTreeMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntAVLTreeMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntAVLTreeMap$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/maps/RBTreeMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/RBTreeMap$*</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntRBTreeMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IntRBTreeMap$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/maps/CustomMap.class</exclude>
+                                <exclude>net/ranides/assira/collection/maps/IdentMap.class</exclude>
 
+                                <exclude>net/ranides/assira/collection/sets/ASet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AIntSet.class</exclude>
+
+                                <exclude>net/ranides/assira/collection/sets/ASortedSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/ASortedSet$*</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AIntSortedSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AIntSortedSet$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/sets/AHashSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AHashSet$*</exclude>
+                                <exclude>net/ranides/assira/collection/sets/HashSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntHashSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntHashSet$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/sets/AVLTreeSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AVLTreeSet$*</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntAVLTreeSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntAVLTreeSet$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/sets/RBTreeSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/RBTreeSet$*</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntRBTreeSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IntRBTreeSet$*</exclude>
+
+                                <exclude>net/ranides/assira/collection/sets/CustomSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/IdentSet.class</exclude>
+                                <exclude>net/ranides/assira/collection/sets/AIdentSet.class</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/lookups/Lookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/Lookup$*</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/ALookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/ALookup$*</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/ASortedLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/ASortedLookup$*</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/lookups/AHashLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/AHashLookup$*</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/lookups/AVLTreeLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/AVLTreeLookup$*</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/RBTreeLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/RBTreeLookup$*</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/lookups/CustomLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/HashLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/IdentLookup.class</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/lookups/AHashLookup.class</exclude>
+                                <exclude>net/ranides/assira/collection/lookups/AHashLookup$*</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/arrays/ArrayAllocator.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/ArraySearch.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/ArraySort.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/ArrayUtils.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/ArrayUtils$*</exclude>
+                                
+                                <exclude>net/ranides/assira/collection/arrays/IntArrayAllocator.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/IntArraySearch.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/IntArraySort.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/IntArrayUtils.class</exclude>
+                                <exclude>net/ranides/assira/collection/arrays/IntArrayUtils$*</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    
     <repositories>
         <repository>
             <id>ranides.net</id>

+ 7 - 4
assira/src/main/java/net/ranides/assira/collection/lists/IntArrayList.java

@@ -58,9 +58,9 @@ public class IntArrayList extends AIntList implements BlockCollection<Integer>,
         "unused",
         "PMD.ArrayIsStoredDirectly"
     })
-    protected IntArrayList(int values[], Wrap wrap) {
+    protected IntArrayList(int values[], int size, Wrap wrap) {
         this.data = values;
-        this.size = values.length;
+        this.size = size;
     }
 
     /**
@@ -180,7 +180,7 @@ public class IntArrayList extends AIntList implements BlockCollection<Integer>,
         if (length > array.length) {
             throw new IllegalArgumentException("The specified length (" + length + ") is greater than the array size (" + array.length + ")");
         }
-        return new IntArrayList(array, Wrap.WRAP);
+        return new IntArrayList(array, length, Wrap.WRAP);
     }
 
     /**
@@ -331,7 +331,7 @@ public class IntArrayList extends AIntList implements BlockCollection<Integer>,
      */
     @Override
     public boolean trim() {
-        return trim(0);
+        return trim(size);
     }
     
     /**
@@ -354,6 +354,9 @@ public class IntArrayList extends AIntList implements BlockCollection<Integer>,
         if (n >= data.length || size == data.length) {
             return true;
         }
+        if(n<size) {
+            throw new IllegalArgumentException(String.format("n= %d is too small (size=%d)", n, size));
+        }
         try {
             int t[] = new int[Math.max(n, size)];
             System.arraycopy(data, 0, t, 0, size);

+ 0 - 8
assira/src/main/java/net/ranides/assira/collection/maps/AIntSortedMap.java

@@ -89,14 +89,6 @@ public abstract class AIntSortedMap<V> extends AIntMap<V> implements IntSortedMa
         return CompareUtils.cmp(acmp, a, b);
     }
     
-    protected final int lower(int a, int b) {
-        return CompareUtils.lower(acmp, a, b);
-    }
-    
-    protected final int higher(int a, int b) {
-        return CompareUtils.higher(acmp, a, b);
-    }
-    
     protected final int lower(boolean ia, int a, boolean ib, int b) {
         if(!ia) {
             return b;

+ 0 - 7
assira/src/main/java/net/ranides/assira/collection/maps/IntHashMap.java

@@ -705,13 +705,6 @@ public class IntHashMap<V> extends AIntMap<V> implements BlockMap<Integer, V>, j
             last = -1; // You can no longer remove this entry.
         }
 
-        public int skip(int n) {
-            int i = n;
-            while (i-- != 0 && hasNext()) {
-                nextEntry();
-            }
-            return n - i - 1;
-        }
     }
 
     private class EntryIterator extends MapIterator implements Iterator<IntEntry<V>> {

+ 46 - 4
assira/src/main/java/net/ranides/assira/test/TMap.java

@@ -19,6 +19,8 @@ import net.ranides.assira.collection.HashComparator;
 import net.ranides.assira.collection.Swapper;
 import net.ranides.assira.collection.arrays.ArrayAllocator;
 import net.ranides.assira.collection.arrays.ArrayUtils;
+import net.ranides.assira.collection.lookups.ALookup;
+import net.ranides.assira.collection.lookups.Lookup.LookupEntry;
 import net.ranides.assira.collection.maps.HashMap;
 import net.ranides.assira.collection.maps.AIntMap;
 import net.ranides.assira.collection.maps.IntMap;
@@ -69,6 +71,25 @@ public abstract class TMap<K,V> implements Serializable {
 
     };
     
+    private final TCollection<LookupEntry<K>> lgen = new TCollection<LookupEntry<K>>() {
+
+        @Override
+        public LookupEntry<K> value(int index, int n) {
+            return TMap.this.item(index, n).lookup();
+        }
+
+        @Override
+        protected int cmp(LookupEntry<K> a, LookupEntry<K> b) {
+            return TMap.this.cmp(a.getKey(),b.getKey());
+        }
+
+        @Override
+        protected int hash(LookupEntry<K> value) {
+            return value.hashCode();
+        }
+
+    };
+    
     private final TCollection<V> vgen = new TCollection<V>() {
 
         @Override
@@ -122,18 +143,26 @@ public abstract class TMap<K,V> implements Serializable {
             return new AbstractMap.SimpleImmutableEntry<>(key, value);
         }
         
-        public IntEntry<V> entryInt() {
-            return new AIntMap.BasicEntry<>(keyInt(), value());
-        }
-        
         public IntMap.Entry<K,V> entry(int value) {
             return new AbstractMap.SimpleImmutableEntry<>(key, that.value(value));
         }
         
+        public IntEntry<V> entryInt() {
+            return new AIntMap.BasicEntry<>(keyInt(), value());
+        }
+        
         public IntMap.IntEntry<V> entryInt(int value) {
             return new AIntMap.BasicEntry<>(keyInt(), that.value(value));
         }
         
+        public LookupEntry<K> lookup(int value) {
+            return new ALookup.BasicEntry<>(key, that.item(value).valueInt());
+        }
+        
+        public LookupEntry<K> lookup() {
+            return new ALookup.BasicEntry<>(key, valueInt());
+        }
+        
 		public <M extends Map<K,V>> M into(M target) {
 			target.put(key(), value());
 			return target;
@@ -192,6 +221,15 @@ public abstract class TMap<K,V> implements Serializable {
             return array;
         }
         
+        @SuppressWarnings("unchecked")
+        public LookupEntry<K>[] lookups() {
+            LookupEntry<K> array[] = new LookupEntry[data.size()];
+            for(int i=0, n=data.size(); i<n; i++) {
+                array[i] = data.get(i).lookup();
+            }
+            return array;
+        }
+        
 		public TItems<K,V> sort(Comparator<K> cmp) {
 			TItems<K,V> items = new TItems<>(that);
 			items.data.addAll(data);
@@ -313,6 +351,10 @@ public abstract class TMap<K,V> implements Serializable {
         return egen;
     }
     
+    public TCollection<LookupEntry<K>> lookups() {
+        return lgen;
+    }
+    
     public TMap<K,V> asIdentity() {
         return new TIdentityMap();
     }

+ 19 - 19
assira/src/main/java/net/ranides/assira/trace/StackInspector.java

@@ -27,9 +27,9 @@ public final class StackInspector {
     // We use "package scope" because we want to test our resolvers in junit
 
     
-    static final Resolver RESOLVER_SR = SunResolver.get();
+    static final Resolver RESOLVER_SR = getSunResolver();
     
-    static final Resolver RESOLVER_SM = SMResolver.get();
+    static final Resolver RESOLVER_SM = getSMResolver();
     
     static final Resolver RESOLVER_TS = () -> new FrameArray(Thread.currentThread().getStackTrace(), 4);
 
@@ -106,6 +106,22 @@ public final class StackInspector {
         List<String> names();
     }
     
+    private static Resolver getSunResolver() {
+        try {
+            return new SunResolver();
+        } catch(Exception | Error cause) {
+            return null;
+        }
+    }
+    
+    private static Resolver getSMResolver() {
+        try {
+            return new SMResolver();
+        } catch(SecurityException se) {
+            return null;
+        }
+    }
+    
     private static final class SMResolver extends SecurityManager implements Resolver {
         
         private static final int FIRST = 2;
@@ -130,14 +146,6 @@ public final class StackInspector {
             return new NameArray(super.getClassContext(), FIRST);
         }
         
-        public static Resolver get() {
-            try {
-                return new SMResolver();
-            } catch(SecurityException se) {
-                return null;
-            }
-        }
-        
     }
     
     private static final class SunResolver implements Resolver {
@@ -152,7 +160,7 @@ public final class StackInspector {
         @Override
         public Class<?> firstClass() {
             return sun.reflect.Reflection.getCallerClass(FIRST);
-        }
+            }
         
         @Override
         public List<Class> list() {
@@ -176,14 +184,6 @@ public final class StackInspector {
             return list;
         }
         
-        public static Resolver get() {
-            try {
-                return new SunResolver();
-            } catch(Exception | Error se) {
-                return null;
-            }
-        }
-        
     }
 
     private static final class ClassArray extends AbstractList<Class> {

+ 59 - 0
assira/src/test/java/net/ranides/assira/collection/lists/IntArrayListTest.java

@@ -0,0 +1,59 @@
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.lists;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import net.ranides.assira.collection.mockup.CollectionSuite;
+import net.ranides.assira.collection.mockup.TMaps;
+import static net.ranides.assira.junit.NewAssert.*;
+import net.ranides.assira.test.TCollection;
+import org.junit.Test;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public class IntArrayListTest {
+    
+    private final TCollection<Integer> $list = TMaps.MAP_IS.keys();
+
+    @Test
+    public void testSuite() {
+        CollectionSuite.SUITE
+			.param("set!", $list)
+			.param("list!", $list)
+			.run(() -> new IntArrayList());
+    }
+
+    @Test
+    public void testConstruct() {
+        assertNotNull(new IntArrayList(32));
+        assertThrows(IllegalArgumentException.class, ()->{new IntArrayList(-1);});
+    }
+    
+    @Test
+    public void testConstructCopy() {
+        IntRange r = new IntRange(0, 10);
+        List<Integer> exp = Arrays.asList(0,1,2,3,4,5,6,7,8,9);
+        
+        assertEquals(10, new IntArrayList(r).size());
+        assertEquals(exp, new IntArrayList(r));
+        assertEquals(exp, new IntArrayList(new IntArrayList(r)));
+        assertEquals(new IntArrayList(r), new IntArrayList(new IntArrayList(r)));
+        assertEquals(Arrays.asList(1,2,3,8), new IntArrayList(new int[]{1,2,3,8}));
+        assertEquals(Arrays.asList(2,3,8), new IntArrayList(new int[]{1,2,3,8,10,11},1,3));
+        
+        assertEquals(exp, new IntArrayList(r.iterator()));
+        assertEquals(exp, new IntArrayList(new ArrayList<>(r).iterator()));
+        
+//        assertNotNull(new IntArrayList(32));
+//        assertThrows(IllegalArgumentException.class, ()->{new IntArrayList(-1);});
+    }
+    
+}

+ 2 - 0
assira/src/test/java/net/ranides/assira/collection/maps/IntAVLTreeMapTest.java

@@ -49,6 +49,7 @@ public class IntAVLTreeMapTest {
 		IntAVLTreeMap<String> smap1 = new IntAVLTreeMap<>(items.keysInt(), items.values(), cmp1);
 		IntAVLTreeMap<String> smap2 = new IntAVLTreeMap<>(items.keysInt(), items.values(), cmp2);
 		IntAVLTreeMap<String> smap3 = new IntAVLTreeMap<>(items.keysInt(), items.values(), cmp3);
+		IntHashMap<String> hmap1 = new IntHashMap<>(items.keysInt(), items.values());
 
 		assertEquals(180, smap1.size());
 		assertEquals(120, smap2.size());
@@ -58,6 +59,7 @@ public class IntAVLTreeMapTest {
 		
         assertEquals(180, new IntAVLTreeMap<>(imap).size());
         assertEquals(180, new IntAVLTreeMap<>((SortedMap<Integer, String>)imap).size());
+        assertEquals(180, new IntAVLTreeMap<>(hmap1).size());
         
         assertEquals(180, new IntAVLTreeMap<>(smap1).size());
         assertEquals(120, new IntAVLTreeMap<>(smap2).size());

+ 2 - 0
assira/src/test/java/net/ranides/assira/collection/maps/IntRBTreeMapTest.java

@@ -49,6 +49,7 @@ public class IntRBTreeMapTest {
 		IntRBTreeMap<String> smap1 = new IntRBTreeMap<>(items.keysInt(), items.values(), cmp1);
 		IntRBTreeMap<String> smap2 = new IntRBTreeMap<>(items.keysInt(), items.values(), cmp2);
 		IntRBTreeMap<String> smap3 = new IntRBTreeMap<>(items.keysInt(), items.values(), cmp3);
+        IntHashMap<String> hmap1 = new IntHashMap<>(items.keysInt(), items.values());
 
 		assertEquals(180, smap1.size());
 		assertEquals(120, smap2.size());
@@ -58,6 +59,7 @@ public class IntRBTreeMapTest {
 		
         assertEquals(180, new IntRBTreeMap<>(imap).size());
         assertEquals(180, new IntRBTreeMap<>((SortedMap<Integer, String>)imap).size());
+        assertEquals(180, new IntRBTreeMap<>(hmap1).size());
         
         assertEquals(180, new IntRBTreeMap<>(smap1).size());
         assertEquals(120, new IntRBTreeMap<>(smap2).size());

+ 3 - 0
assira/src/test/java/net/ranides/assira/collection/mockup/CollectionSuite.java

@@ -7,6 +7,7 @@
 package net.ranides.assira.collection.mockup;
 
 import net.ranides.assira.collection.suite.BlockCollectionTester;
+import net.ranides.assira.collection.suite.lists.ListTester;
 import net.ranides.assira.collection.suite.maps.BlockMapTester;
 import net.ranides.assira.collection.suite.maps.AHashMapTester;
 import net.ranides.assira.collection.suite.maps.ASortedMapTester;
@@ -47,6 +48,8 @@ public final class CollectionSuite {
         .append(new SortedSetTester())
         .append(new BlockMapTester())
         .append(new BlockCollectionTester())
+        
+        .append(new ListTester())
 		;
    
 }

+ 35 - 0
assira/src/test/java/net/ranides/assira/collection/suite/lists/ListTester.java

@@ -0,0 +1,35 @@
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.suite.lists;
+
+import java.util.List;
+import javax.annotation.Resource;
+import net.ranides.assira.junit.InterfaceTest;
+import net.ranides.assira.test.TCollection;
+import static net.ranides.assira.junit.NewAssert.*;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public class ListTester<T> {
+    
+    @Resource(name = "list!")
+    private TCollection<T> $list;
+    
+    @InterfaceTest
+    public void basicAdd(List<T> target) {
+        assertEquals(0, target.size());
+        
+        for(TCollection.TItem<T> item : $list.range(32)) {
+            target.add(item.value());
+        }
+        
+        assertEquals(32, target.size());
+        assertEquals($list.item(4).value(), target.get(4));
+    }
+}

+ 397 - 1
assira/src/test/java/net/ranides/assira/collection/suite/lookups/SortedLookupTester.java

@@ -6,11 +6,18 @@
  */
 package net.ranides.assira.collection.suite.lookups;
 
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.NoSuchElementException;
+import java.util.Set;
 import java.util.SortedSet;
 import javax.annotation.Resource;
 import net.ranides.assira.collection.lookups.Lookup.LookupEntry;
 import net.ranides.assira.collection.lookups.SortedLookup;
+import net.ranides.assira.collection.suite.IteratorTester;
+import net.ranides.assira.collection.suite.sets.SetTester;
 import net.ranides.assira.test.TMap;
 import net.ranides.assira.junit.InterfaceTest;
 import static net.ranides.assira.junit.NewAssert.*;
@@ -26,7 +33,7 @@ public final class SortedLookupTester<K> {
     private TMap<K,Integer> $map;
     
     @InterfaceTest
-    public void basicBounds_EntrySet(SortedLookup<K> target) {
+    public void basicBounds_EntrySetF(SortedLookup<K> target) {
         SortedSet<LookupEntry<K>> set = target.fastEntrySet();
         assertThrows(NoSuchElementException.class, ()->
             set.first()
@@ -38,5 +45,394 @@ public final class SortedLookupTester<K> {
         assertEquals( set.first(), $map.item(1).entry() );
         assertEquals( set.last(), $map.item(5).entry() );
     }
+    
+    @InterfaceTest
+    public void basicBounds_EntrySet(SortedLookup<K> target) {
+        SortedSet<Entry<K, Integer>> set = target.entrySet();
+        assertThrows(NoSuchElementException.class, ()->
+            set.first()
+        );
+        assertThrows(NoSuchElementException.class, ()->
+            set.last()
+        );
+        $map.list(2,5,3,1,4).into(target);
+        assertEquals( set.first(), $map.item(1).entry() );
+        assertEquals( set.last(), $map.item(5).entry() );
+    }
+    
+    @InterfaceTest
+    public void basicKeys_Head(SortedLookup<K> target) {
+        SetTester.assertHead($map.keys(), target.keySet(), $map.list().keys());
+        $map.list(4, 7, 5, 3, 6).into(target);
+        SetTester.assertHead($map.keys(), target.keySet(), $map.list(3, 4, 5, 6, 7).keys());
+    }
+    
+    @InterfaceTest
+    public void basicKeys_Tail(SortedLookup<K> target) {
+        SetTester.assertTail($map.keys(), target.keySet(), $map.list().keys());
+        $map.list(4, 7, 5, 3, 6).into(target);
+        SetTester.assertTail($map.keys(), target.keySet(), $map.list(3, 4, 5, 6, 7).keys());
+    }
+    
+    @InterfaceTest
+    public void basicKeys_Sub(SortedLookup<K> target) {
+        SetTester.assertTail($map.keys(), target.keySet(), $map.list().keys());
+        $map.list(4, 7, 5, 3, 6).into(target);
+        SetTester.assertTail($map.keys(), target.keySet(), $map.list(3, 4, 5, 6, 7).keys());
+    }
+    
+    @InterfaceTest
+    public void basicEntries_Head(SortedLookup<K> target) {
+        SetTester.assertHead($map.entries(), target.entrySet(), $map.list().entries());
+        SetTester.assertHead($map.lookups(), target.fastEntrySet(), $map.list().lookups());
+        $map.list(4, 7, 5, 3, 6).into(target);
+        
+        SetTester.assertHead($map.entries(), target.entrySet(), $map.list(3, 4, 5, 6, 7).entries());
+        SetTester.assertHead($map.lookups(), target.fastEntrySet(), $map.list(3, 4, 5, 6, 7).lookups());
+    }
+    
+    @InterfaceTest
+    public void basicEntries_Tail(SortedLookup<K> target) {
+        SetTester.assertTail($map.entries(), target.entrySet(), $map.list().entries());
+        SetTester.assertTail($map.lookups(), target.fastEntrySet(), $map.list().lookups());
+        
+        $map.list(4, 7, 5, 3, 6).into(target);
+        
+        SetTester.assertTail($map.entries(), target.entrySet(), $map.list(3, 4, 5, 6, 7).entries());
+        SetTester.assertTail($map.lookups(), target.fastEntrySet(), $map.list(3, 4, 5, 6, 7).lookups());
+    }
+    
+    @InterfaceTest
+    public void basicEntries_Sub(SortedLookup<K> target) {
+        SetTester.assertSub($map.entries(), target.entrySet(), $map.list().entries());
+        SetTester.assertSub($map.lookups(), target.fastEntrySet(), $map.list().lookups());
+        
+        $map.list(4, 7, 5, 3, 6).into(target);
+        
+        SetTester.assertSub($map.entries(), target.entrySet(), $map.list(3, 4, 5, 6, 7).entries());
+        SetTester.assertSub($map.lookups(), target.fastEntrySet(), $map.list(3, 4, 5, 6, 7).lookups());
+    }
+    
+    @SuppressWarnings("unchecked")
+    @InterfaceTest
+    public void basicIterator(SortedLookup<K> target) {
+        TMap.TItems<K,Integer> list1 = $map.list();
+        TMap.TItems<K,Integer> list2 = $map.list(3, 4, 5, 6, 7);
+        
+        IteratorTester.basicIterator(target.keySet().iterator(), 0, list1.keys());
+        IteratorTester.basicIterator(target.entrySet().iterator(), 0, list1.entries());
+        IteratorTester.basicIterator(target.fastEntrySet().iterator(), 0, list1.lookups());
+        IteratorTester.basicIterator((ListIterator)target.values().iterator(), 0, list1.values());
+        
+        $map.list(4, 7, 5, 3, 6).into(target);
+        
+        IteratorTester.basicIterator(target.keySet().iterator(), 0, list2.keys());
+        IteratorTester.basicIterator(target.entrySet().iterator(), 0, list2.entries());
+        IteratorTester.basicIterator(target.fastEntrySet().iterator(), 0, list2.lookups());
+        IteratorTester.basicIterator((ListIterator)target.values().iterator(), 0, list2.values());
+    }
+    
+    @SuppressWarnings("unchecked")
+    @InterfaceTest
+    public void basicIteratorFrom(SortedLookup<K> target) {
+        TMap.TItems<K,Integer> list1 = $map.list();
+        TMap.TItems<K,Integer> list2 = $map.list(3, 4, 5, 6, 7);
+        TMap.TItem<K,Integer> item = $map.item(4);
+        
+        IteratorTester.basicIterator(target.keySet().iterator(item.key()), 0, list1.keys());
+        IteratorTester.basicIterator(target.entrySet().iterator(item.entry()), 0, list1.entries());
+        IteratorTester.basicIterator(target.fastEntrySet().iterator(item.lookup()), 0, list1.lookups());
+        
+        $map.list(4, 7, 5, 3, 6).into(target);
+        
+        IteratorTester.basicIterator(target.keySet().iterator(item.key()), 2, list2.keys());
+        IteratorTester.basicIterator(target.entrySet().iterator(item.entry()), 2, list2.entries());
+        IteratorTester.basicIterator(target.fastEntrySet().iterator(item.lookup()), 2, list2.lookups());
+    }
+    
+    @SuppressWarnings("unchecked")
+    @InterfaceTest
+    public void basicSubmapIteratorFrom(SortedLookup<K> target) {
+        TMap.TItems<K,Integer> list = $map.list(3, 4, 5, 6, 7);
+        TMap.TItem<K,Integer> item = $map.item(4);
+
+        $map.list(4, 7, 5, 3, 6, 1, 8).into(target);
+        SortedLookup<K> map = target.subMap($map.item(1).key(), $map.item(8).key());
+        
+        IteratorTester.subrangeIterator(map.keySet().iterator(item.key()), 2, list.keys());
+        IteratorTester.subrangeIterator(map.entrySet().iterator(item.entry()), 2, list.entries());
+        IteratorTester.subrangeIterator(map.fastEntrySet().iterator(item.lookup()), 2, list.lookups());
+    }
+    
+    
+    @InterfaceTest
+    public void fastEntrySet_ContainsHC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        assertEquals(0, set.size());
+		
+        $map.list().item(1).item(1,1).item(2).item(3).into(target);
+		assertEquals(4, set.size());
+        assertEquals(true, set.contains($map.item(1).lookup()));
+        assertEquals(true, set.contains($map.item(1,1).lookup()));
+        assertEquals(true, set.contains($map.item(2).lookup()));
+        assertEquals(true, set.contains($map.item(3).lookup()));
+        
+        assertEquals(false, set.contains($map.item(4).lookup()));
+        assertEquals(false, set.contains(new Object()));
+        
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Contains(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        assertEquals(0, set.size());
+		
+        $map.list(1,2,3,5).into(target);
+		assertEquals(4, set.size());
+        assertEquals(true, set.contains($map.item(1).lookup()));
+        assertEquals(true, set.contains($map.item(2).lookup()));
+        assertEquals(true, set.contains($map.item(3).lookup()));
+        assertEquals(true, set.contains($map.item(5).lookup()));
+        
+        assertEquals(false, set.contains($map.item(4).lookup()));
+        assertEquals(false, set.contains(new Object()));
+        
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Remove(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        $map.list(1,2,3,7).into(target);
+		
+        assertEquals(false, set.remove($map.item(1).lookup(5)));
+        assertEquals(true, set.remove($map.item(1).lookup()));
+        assertEquals(false, set.remove($map.item(4).lookup()));
+        assertEquals(false, set.remove(new Object()));
+        
+        assertEquals(false, set.contains($map.item(1).lookup()));
+        assertEquals(true, set.contains($map.item(2).lookup()));
+        assertEquals(true, set.contains($map.item(3).lookup()));
+        assertEquals(true, set.contains($map.item(7).lookup()));
+        
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_RemoveHC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        $map.list().item(1).item(1,1).item(2).item(3).into(target);
+		
+        assertEquals(false, set.remove($map.item(1).lookup(5)));
+        assertEquals(true, set.remove($map.item(1).lookup()));
+        assertEquals(false, set.remove($map.item(4).lookup()));
+        assertEquals(false, set.remove(new Object()));
+        
+        assertEquals(false, set.contains($map.item(1).lookup()));
+        assertEquals(true, set.contains($map.item(1,1).lookup()));
+        assertEquals(true, set.contains($map.item(2).lookup()));
+        assertEquals(true, set.contains($map.item(3).lookup()));
+        
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_IteratorHC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+		assertEquals(4, set.size());
+
+        Iterator<LookupEntry<K>> iterator = set.iterator();
+        while(iterator.hasNext()) {
+            LookupEntry<K> entry = iterator.next();
+            assertEquals(target.getInt(entry.getKey()), entry.getIntValue());
+        }
+        
+        assertThrows(NoSuchElementException.class, ()-> iterator.next());
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+		
+        assertEquals(0, set.size());
+		$map.list(1,2,3,5).into(target);
+		assertEquals(4, set.size());
+
+        Iterator<LookupEntry<K>> iterator = set.iterator();
+        while(iterator.hasNext()) {
+            LookupEntry<K> entry = iterator.next();
+            assertEquals(target.getInt(entry.getKey()), entry.getIntValue());
+        }
+        
+        assertThrows(NoSuchElementException.class, ()-> iterator.next());
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_SetValueHC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+                
+		assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+        K k1 = $map.item(1).key();
+		K k2 = $map.item(2).key();
+        int v1 = $map.item(101).valueInt();
+        int v2 = $map.item(102).valueInt();
+		
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			LookupEntry<K> entry = iterator.next();
+			if(k1.equals(entry.getKey())) {
+                entry.setValue(v1);
+            }
+            if(k2.equals(entry.getKey())) {
+                entry.setValue(v2);
+            }
+		}
+		assertContains(target, $map.item(1).key(), v1);
+		assertContains(target, $map.item(2).key(), v2);
+		assertContains(target, $map.item(1,1));
+		assertContains(target, $map.item(3));
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_SetValue(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+                
+		assertEquals(0, set.size());
+		$map.list(1,2,3,5).into(target);
+        K k1 = $map.item(1).key();
+		K k2 = $map.item(2).key();
+        int v1 = $map.item(101).value();
+        int v2 = $map.item(102).value();
+		
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			LookupEntry<K> entry = iterator.next();
+			if(k1.equals(entry.getKey())) {
+                entry.setValue(v1);
+            }
+            if(k2.equals(entry.getKey())) {
+                entry.setValue(v2);
+            }
+		}
+		assertContains(target, $map.item(1).key(), v1);
+		assertContains(target, $map.item(2).key(), v2);
+		assertContains(target, $map.item(5));
+		assertContains(target, $map.item(3));
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_RemoveHC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+        
+		assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+        K k1 = $map.item(1).key();
+		K k2 = $map.item(2).key();
+		
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			LookupEntry<K> entry = iterator.next();
+            K key = entry.getKey();
+            
+			if(k1.equals(key)) {
+                iterator.remove();
+            }
+            if(k2.equals(key)) {
+                iterator.remove();
+                assertThrows(IllegalStateException.class, ()-> iterator.remove());
+            }
+		}
+        
+        assertEquals(2, target.size());
+        assertNotContains(target, $map.item(1));
+        assertNotContains(target, $map.item(2));
+		assertContains(target, $map.item(1,1));
+		assertContains(target, $map.item(3));
+        
+        set.clear();
+        assertEquals(0, target.size());
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_Remove(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+        
+		assertEquals(0, set.size());
+		$map.list(1,2,3,5).into(target);
+        K k1 = $map.item(1).key();
+		K k2 = $map.item(2).key();
+		
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			LookupEntry<K> entry = iterator.next();
+            K key = entry.getKey();
+            
+			if(k1.equals(key)) {
+                iterator.remove();
+            }
+            if(k2.equals(key)) {
+                iterator.remove();
+                assertThrows(IllegalStateException.class, ()-> iterator.remove());
+            }
+		}
+        
+        assertEquals(2, target.size());
+        assertNotContains(target, $map.item(1));
+        assertNotContains(target, $map.item(2));
+		assertContains(target, $map.item(3));
+		assertContains(target, $map.item(5));
+        
+        set.clear();
+        assertEquals(0, target.size());
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_RemoveAll_HC(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+        
+		assertEquals(0, set.size());
+        $map.urange(1024).into(target);
+            
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			iterator.next();
+            iterator.remove();
+		}
+        assertEquals(0, target.size());
+	}
+    
+    @InterfaceTest
+    public void fastEntrySet_Iterator_RemoveAll(SortedLookup<K> target) {
+        Set<LookupEntry<K>> set = target.fastEntrySet();
+        
+		assertEquals(0, set.size());
+        $map.range(1024).into(target);
+            
+		Iterator<LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			iterator.next();
+            iterator.remove();
+		}
+        assertEquals(0, target.size());
+	}
+    
+    private void assertContains(SortedLookup<K> target, K key, int value) {
+        assertEquals(true, target.containsKey(key));
+        assertEquals(value, target.getInt(key));
+    }
+    
+    private void assertContains(SortedLookup<K> target, TMap.TItem<K,?> item) {
+		assertContains(target, item.key(), item.valueInt());
+    }
+    
+    private void assertNotContains(SortedLookup<K> target, TMap.TItem<K,?> item) {
+        assertEquals(false, target.containsKey(item.key()));
+        assertEquals(null, target.get(item.key()));
+    }
 
 }