Forráskód Böngészése

assira: injections in unit-tests work

Ranides Atterwim 10 éve
szülő
commit
859de6f8da

+ 60 - 0
assira/src/test/java/net/ranides/assira/collection/mockup/TComparator.java

@@ -0,0 +1,60 @@
+
+package net.ranides.assira.collection.mockup;
+
+import java.util.Map.Entry;
+import net.ranides.assira.collection.HashComparator;
+import net.ranides.assira.collection.mockup.TMap.TItem;
+
+/**
+ *
+ * @author msieron
+ */
+public class TComparator<K,V> {
+	
+	private final HashComparator<K> cmp;
+
+	public TComparator(HashComparator<K> cmp) {
+		this.cmp = cmp;
+	}
+	
+	public int cmp(TItem<K,V> a, TItem<K,V> b) {
+		return kcmp(a.key(), b.key());
+	}
+	
+	public int cmp(Entry<K,V> a, Entry<K,V> b) {
+		return kcmp(a.getKey(), b.getKey());
+	}
+	
+	public int cmp(Entry<K,V> a, TItem<K,V> b) {
+		return kcmp(a.getKey(), b.key());
+	}
+	
+	public int cmp(TItem<K,V> a, Entry<K,V> b) {
+		return kcmp(a.key(), b.getKey());
+	}
+	
+	public boolean equals(TItem<K,V> a, TItem<K,V> b) {
+		return 0 == cmp(a, b);
+	}
+	
+	public boolean equals(Entry<K,V> a, Entry<K,V> b) {
+		return 0 == cmp(a, b);
+	}
+	
+	public boolean equals(TItem<K,V> a, Entry<K,V> b) {
+		return 0 == cmp(a, b);
+	}
+	
+	public boolean equals(Entry<K,V> a, TItem<K,V> b) {
+		return 0 == cmp(a, b);
+	}
+	
+	public int kcmp(K a, K b) {
+		return cmp.compare(a,b);
+	}
+	
+	public boolean kequals(K a, K b) {
+		return 0 == kcmp(a, b);
+	}
+
+}

+ 240 - 209
assira/src/test/java/net/ranides/assira/collection/mockup/TMap.java

@@ -1,209 +1,240 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/???
- */
-package net.ranides.assira.collection.mockup;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.TreeMap;
-import net.ranides.assira.collection.arrays.ArrayAllocator;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public abstract class TMap<K,V> {
-    
-    public static final class TItem<K,V> {
-        
-        private final TMap<K,V> that;
-        
-        private final K key;
-        
-        private final V value;
-
-        protected TItem(TMap<K,V> that, K key, V value) {
-            this.that = that;
-            this.key = key;
-            this.value = value;
-        }
-        
-        public K key() {
-            return key;
-        }
-        
-        public V value() {
-            return value;
-        }
-        
-        public int keyInt() {
-            return (Integer)key;
-        }
-        
-        public int valueInt() {
-            return (Integer)value;
-        }
-        
-        public Entry<K,V> entry() {
-            return new AbstractMap.SimpleImmutableEntry<>(key, value);
-        }
-        
-        public TItem<K,V> next() {
-            return new TItem<>(that, that.nextKey(key), that.nextValue(value));
-        }
-        
-    }
-    
-    public static final class TItems<K,V> implements Iterable<TItem<K,V>> {
-        
-        private final TMap<K,V> that;
-        
-        private final List<TItem<K,V>> data = new ArrayList<>();
-        
-        protected TItems(TMap<K,V> that) {
-            this.that = that;
-        }
-        
-        public K[] keys() {
-            K[] array = ArrayAllocator.allocate(that.key(0).getClass(), data.size());
-            for(int i=0,n=data.size(); i<n; i++) {
-                array[i] = data.get(i).key();
-            }
-            return array;
-        }
-        
-        public V[] values() {
-            V[] array = ArrayAllocator.allocate(that.value(0).getClass(), data.size());
-            for(int i=0,n=data.size(); i<n; i++) {
-                array[i] = data.get(i).value();
-            }
-            return array;
-        }
-        
-        public int[] keysInt() {
-            int[] array = new int[data.size()];
-            for(int i=0,n=data.size(); i<n; i++) {
-                array[i] = data.get(i).keyInt();
-            }
-            return array;
-        }
-        
-        public int[] valuesInt() {
-            int[] array = new int[data.size()];
-            for(int i=0,n=data.size(); i<n; i++) {
-                array[i] = data.get(i).valueInt();
-            }
-            return array;
-        }
-        
-        public Entry<K,V>[] entries() {
-            Entry<K,V> array[] = new Entry[data.size()];
-            for(int i=0, n=data.size(); i<n; i++) {
-                array[i] = data.get(i).entry();
-            }
-            return array;
-        }
-        
-        public Map<K,V> map(Comparator<K> cmp) {
-            Map<K, V> target = new TreeMap<>(cmp);
-            for (int i = 0, n=data.size(); i<n; i++) {
-                target.put(data.get(i).key(), data.get(i).value());
-            }
-            return target;
-        }
-        
-        public TItems<K,V> next() {
-            TItems<K,V> items = new TItems(that);
-            for(int i=0, n=data.size(); i<n; i++) {
-                items.data.add(data.get(i).next());
-            }
-            return items;
-        }
-        
-        public TItems<K,V> shuffle(long seed) {
-            int n = data.size();
-            Random random = new Random(seed);
-            for(int i=0; i<n; i++) {
-                int a = random.nextInt(n);
-                int b = random.nextInt(n);
-                swap(a, b);
-            }
-            return this;
-        }
-
-        private void swap(int ai, int bi) {
-            TItem a = data.get(ai);
-            data.set(ai, data.get(bi));
-            data.set(bi, a);
-        }
-        
-        public TItems<K,V> add(TItem item) {
-            data.add(item);
-            return this;
-        }
-        
-        public TItems<K,V> add(TItems items) {
-            data.addAll(items.data);
-            return this;
-        }
-
-        @Override
-        public Iterator<TItem<K,V>> iterator() {
-            return data.iterator();
-        }
-        
-        public TItem<K,V> at(int index) {
-            return data.get(index);
-        }
-        
-    }
-    
-    protected abstract K key(int index);
-    
-    protected abstract V value(int index);
-    
-    protected abstract K nextKey(K key);
-    
-    protected abstract V nextValue(V value);
-    
-    public TItem<K,V> item(int index) {
-        return new TItem<>(this, key(index), value(index));
-    }
-    
-    public TItems<K,V> list(int... indexes) {
-        TItems<K,V> ret = new TItems<>(this);
-        for(int i=0; i<indexes.length; i++) {
-            ret.data.add(item(indexes[i]));
-        }
-        return ret;
-    }
-    
-    public TItems<K,V> range(int begin, int end) {
-        TItems<K,V> ret = new TItems<>(this);
-        for(int i=begin; i<end; i++) {
-            ret.data.add(item(i));
-        }
-        return ret;
-    }
-    
-    public TItems<K,V> urange(int begin, int end) {
-        TItems<K,V> items = range(begin, end);
-        return new TItems<>(this).add(items).add(items).add(items.next()).shuffle(777);
-    }
-    
-    public void put(Map<K,V> target, TItems<K,V> items) {
-        for(TItem<K,V> item : items) {
-            target.put(item.key(), item.value());
-        }
-    }
-
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.mockup;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.TreeMap;
+import net.ranides.assira.collection.arrays.ArrayAllocator;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public abstract class TMap<K,V> {
+    
+    public static final class TItem<K,V> {
+        
+        private final TMap<K,V> that;
+        
+        private final K key;
+        
+        private final V value;
+
+        protected TItem(TMap<K,V> that, K key, V value) {
+            this.that = that;
+            this.key = key;
+            this.value = value;
+        }
+        
+        public K key() {
+            return key;
+        }
+        
+        public V value() {
+            return value;
+        }
+        
+        public int keyInt() {
+            return (Integer)key;
+        }
+        
+        public int valueInt() {
+            return (Integer)value;
+        }
+        
+        public Entry<K,V> entry() {
+            return new AbstractMap.SimpleImmutableEntry<>(key, value);
+        }
+        
+        public TItem<K,V> next() {
+            return new TItem<>(that, that.nextKey(key), that.nextValue(value));
+        }
+		
+		public TItem<K,V> next(int count) {
+			TItem<K,V> item = this;
+			for(int i=0; i<count; i++) {
+				item = item.next();
+			}
+			return item;
+		}
+		
+		public Map<K,V> into(Map<K,V> target) {
+			target.put(key(), value());
+			return target;
+		}
+        
+    }
+    
+    public static final class TItems<K,V> implements Iterable<TItem<K,V>> {
+        
+        private final TMap<K,V> that;
+        
+        private final List<TItem<K,V>> data = new ArrayList<>();
+        
+        protected TItems(TMap<K,V> that) {
+            this.that = that;
+        }
+        
+        public K[] keys() {
+            K[] array = ArrayAllocator.allocate(that.key(0).getClass(), data.size());
+            for(int i=0,n=data.size(); i<n; i++) {
+                array[i] = data.get(i).key();
+            }
+            return array;
+        }
+        
+        public V[] values() {
+            V[] array = ArrayAllocator.allocate(that.value(0).getClass(), data.size());
+            for(int i=0,n=data.size(); i<n; i++) {
+                array[i] = data.get(i).value();
+            }
+            return array;
+        }
+        
+        public int[] keysInt() {
+            int[] array = new int[data.size()];
+            for(int i=0,n=data.size(); i<n; i++) {
+                array[i] = data.get(i).keyInt();
+            }
+            return array;
+        }
+        
+        public int[] valuesInt() {
+            int[] array = new int[data.size()];
+            for(int i=0,n=data.size(); i<n; i++) {
+                array[i] = data.get(i).valueInt();
+            }
+            return array;
+        }
+        
+		@SuppressWarnings("unchecked")
+        public Entry<K,V>[] entries() {
+            Entry<K,V> array[] = new Entry[data.size()];
+            for(int i=0, n=data.size(); i<n; i++) {
+                array[i] = data.get(i).entry();
+            }
+            return array;
+        }
+        
+        public Map<K,V> map(Comparator<K> cmp) {
+            Map<K, V> target = new TreeMap<>(cmp);
+            for (int i = 0, n=data.size(); i<n; i++) {
+                target.put(data.get(i).key(), data.get(i).value());
+            }
+            return target;
+        }
+        
+        public TItems<K,V> next() {
+            return next(1);
+        }
+		
+		public TItems<K,V> next(int count) {
+			TItems<K,V> items = new TItems<K,V>(that);
+            for(int i=0, n=data.size(); i<n; i++) {
+                items.data.add(data.get(i).next(count));
+            }
+            return items;
+		}
+        
+        public TItems<K,V> shuffle(long seed) {
+            int n = data.size();
+            Random random = new Random(seed);
+            for(int i=0; i<n; i++) {
+                int a = random.nextInt(n);
+                int b = random.nextInt(n);
+                swap(a, b);
+            }
+            return this;
+        }
+
+        private void swap(int ai, int bi) {
+            TItem<K,V> a = data.get(ai);
+            data.set(ai, data.get(bi));
+            data.set(bi, a);
+        }
+        
+        public TItems<K,V> item(TItem<K,V> item) {
+            data.add(item);
+            return this;
+        }
+        
+        public TItems<K,V> item(TItems<K,V> items) {
+            data.addAll(items.data);
+            return this;
+        }
+		
+		public TItems<K,V> item(int item) {
+			return TItems.this.item(that.item(item));
+		}
+		
+		public TItems<K,V> item(int item, int next) {
+			return TItems.this.item(that.item(item).next(next));
+		}
+
+        @Override
+        public Iterator<TItem<K,V>> iterator() {
+            return data.iterator();
+        }
+        
+        public TItem<K,V> at(int index) {
+            return data.get(index);
+        }
+		
+		public Map<K,V> into(Map<K,V> target) {
+			for(TItem<K,V> item : data) {
+				target.put(item.key(), item.value());
+			}
+			return target;
+		}
+        
+    }
+    
+    protected abstract K key(int index);
+    
+    protected abstract V value(int index);
+    
+    protected abstract K nextKey(K key);
+    
+    protected abstract V nextValue(V value);
+    
+    public TItem<K,V> item(int index) {
+        return new TItem<>(this, key(index), value(index));
+    }
+	
+	public TItem<K,V> item(int index, int next) {
+        return item(index).next(next);
+    }
+	
+    public TItems<K,V> list(int... indexes) {
+        TItems<K,V> ret = new TItems<>(this);
+        for(int i=0; i<indexes.length; i++) {
+            ret.data.add(item(indexes[i]));
+        }
+        return ret;
+    }
+    
+    public TItems<K,V> range(int begin, int end) {
+        TItems<K,V> ret = new TItems<>(this);
+        for(int i=begin; i<end; i++) {
+            ret.data.add(item(i));
+        }
+        return ret;
+    }
+    
+    public TItems<K,V> urange(int begin, int end) {
+        TItems<K,V> items = range(begin, end);
+        return new TItems<>(this).item(items).item(items).item(items.next()).shuffle(777);
+    }
+
+}

+ 121 - 121
assira/src/test/java/net/ranides/assira/collection/mockup/TPoint.java

@@ -1,121 +1,121 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira
- */
-package net.ranides.assira.collection.mockup;
-
-import java.io.Serializable;
-import net.ranides.assira.collection.HashComparator;
-import net.ranides.assira.generic.HashUtils;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public class TPoint implements Serializable {
-    
-    private static final long serialVersionUID = 1L;
-
-    public final int x;
-    public final int y;
-    public final int z;
-
-    public TPoint(int x, int y, int z) {
-        this.x = x;
-        this.y = y;
-        this.z = z;
-    }
-
-    @Override
-    public int hashCode() {
-        return HashUtils.hashValues(3, 37, x, y);
-    }
-
-    @Override
-    public boolean equals(Object object) {
-        if (this == object) {
-            return true;
-        }
-        if (object == null) {
-            return false;
-        }
-        if (getClass() != object.getClass()) {
-            return false;
-        }
-        return STD.equals(this, (TPoint)object);
-    }
-    
-    private static int zz(int z) {
-        return z & 0x3FF;
-    }
-
-    @Override
-    public String toString() {
-        return "(" + x + ":" + y + ":" + z + ")";
-    }
-    
-    public static final HashComparator<TPoint> SUM = new HashComparator<TPoint>() {
-        
-        private static final long serialVersionUID = 1L;
-        
-        @Override
-        public int hashCode(TPoint object) {
-            return object.x;
-        }
-
-        @Override
-        public int compare(TPoint value1, TPoint value2) {
-            int a = value1.x + value1.y + zz(value1.z);
-            int b = value2.x + value2.y + zz(value2.z);
-            return a-b;
-        }
-        
-        
-    };
-    
-    public static final HashComparator<TPoint> STD = new HashComparator<TPoint>() {
-        
-        private static final long serialVersionUID = 1L;
-        
-        @Override
-        public int hashCode(TPoint object) {
-            return HashUtils.hashValues(1, 1199, object.x, object.y, object.z);
-        }
-
-        @Override
-        public int compare(TPoint value1, TPoint value2) {
-            int dx = value1.x - value2.x;
-            int dy = value1.y - value2.y;
-            int dz = zz(value1.z) - zz(value2.z);
-            return dx!=0 ? dx : (dy!=0 ? dy : dz);
-        }
-        
-    };
-    
-    public static final TMap<TPoint, Integer> STD_INT_MAP = new TMap<TPoint, Integer>(){
-
-        @Override
-        protected TPoint key(int index) {
-            return new TPoint(index, index, index);
-        }
-
-        @Override
-        protected Integer value(int index) {
-            return index;
-        }
-
-        @Override
-        protected TPoint nextKey(TPoint key) {
-            return new TPoint(key.x, key.y, key.z+1);
-        }
-
-        @Override
-        protected Integer nextValue(Integer value) {
-            return value + 1;
-        }
-
-    };
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/assira
+ */
+package net.ranides.assira.collection.mockup;
+
+import java.io.Serializable;
+import net.ranides.assira.collection.HashComparator;
+import net.ranides.assira.generic.HashUtils;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public class TPoint implements Serializable {
+    
+    private static final long serialVersionUID = 1L;
+
+    public final int x;
+    public final int y;
+    public final int z;
+
+    public TPoint(int x, int y, int z) {
+        this.x = x;
+        this.y = y;
+        this.z = z;
+    }
+
+    @Override
+    public int hashCode() {
+        return HashUtils.hashValues(3, 37, x, y);
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
+            return true;
+        }
+        if (object == null) {
+            return false;
+        }
+        if (getClass() != object.getClass()) {
+            return false;
+        }
+        return STD.equals(this, (TPoint)object);
+    }
+    
+    private static int zz(int z) {
+        return z & 0x3FF;
+    }
+
+    @Override
+    public String toString() {
+        return "(" + x + ":" + y + ":" + z + ")";
+    }
+    
+    public static final HashComparator<TPoint> SUM = new HashComparator<TPoint>() {
+        
+        private static final long serialVersionUID = 1L;
+        
+        @Override
+        public int hashCode(TPoint object) {
+            return object.x;
+        }
+
+        @Override
+        public int compare(TPoint value1, TPoint value2) {
+            int a = value1.x + value1.y + zz(value1.z);
+            int b = value2.x + value2.y + zz(value2.z);
+            return a-b;
+        }
+        
+        
+    };
+    
+    public static final HashComparator<TPoint> STD = new HashComparator<TPoint>() {
+        
+        private static final long serialVersionUID = 1L;
+        
+        @Override
+        public int hashCode(TPoint object) {
+            return HashUtils.hashValues(1, 1199, object.x, object.y, object.z);
+        }
+
+        @Override
+        public int compare(TPoint value1, TPoint value2) {
+            int dx = value1.x - value2.x;
+            int dy = value1.y - value2.y;
+            int dz = zz(value1.z) - zz(value2.z);
+            return dx!=0 ? dx : (dy!=0 ? dy : dz);
+        }
+        
+    };
+    
+    public static final TMap<TPoint, Integer> STD_INT_MAP = new TMap<TPoint, Integer>(){
+
+        @Override
+        protected TPoint key(int index) {
+            return new TPoint(index, index, index);
+        }
+
+        @Override
+        protected Integer value(int index) {
+            return 10*index;
+        }
+
+        @Override
+        protected TPoint nextKey(TPoint key) {
+            return new TPoint(key.x, key.y, key.z+1);
+        }
+
+        @Override
+        protected Integer nextValue(Integer value) {
+            return value + 1;
+        }
+
+    };
+    
+}

+ 51 - 51
assira/src/test/java/net/ranides/assira/collection/suite/AHashLookupTester.java

@@ -1,51 +1,51 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/???
- */
-package net.ranides.assira.collection.suite;
-
-import javax.annotation.Resource;
-import net.ranides.assira.collection.lookups.AHashLookup;
-import net.ranides.assira.collection.mockup.TMap;
-import net.ranides.assira.junit.QAssert;
-import org.junit.Test;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class AHashLookupTester<K> {
-    
-    @Resource
-    private TMap<K,Integer> $map;
-
-    @Test
-    public void basicTrim(AHashLookup<K> target) {
-        $map.put(target, $map.urange(0, 1024));
-        target.clear();
-        $map.put(target, $map.urange(0, 128));
-        target.trim();
-    }
-    
-    @Test
-    public void basicTrimN1(AHashLookup<K> target) {
-        basicTrim(target, 5*32, 32, 1024);
-    }
-    
-    @Test
-    public void basicTrimN2(AHashLookup<K> target) {
-        QAssert.assertThrows(IllegalArgumentException.class, () -> 
-            basicTrim(target, 5*32, 32, 1)
-        );
-    }
-    
-    private void basicTrim(AHashLookup<K> target, int put1st, int put2nd, int n) {
-        $map.put(target, $map.urange(0, put1st));
-        target.clear();
-        $map.put(target, $map.urange(0, put2nd));
-        target.trim(n);
-    }
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.suite;
+
+import javax.annotation.Resource;
+import net.ranides.assira.collection.lookups.AHashLookup;
+import net.ranides.assira.collection.mockup.TMap;
+import net.ranides.assira.junit.QAssert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public final class AHashLookupTester<K> {
+    
+    @Resource(name = "map!")
+    private TMap<K,Integer> $map;
+
+    @Test
+    public void basicTrim(AHashLookup<K> target) {
+        $map.urange(0, 1024).into(target);
+        target.clear();
+        $map.urange(0, 128).into(target);
+        target.trim();
+    }
+    
+    @Test
+    public void basicTrimN1(AHashLookup<K> target) {
+        basicTrim(target, 5*32, 32, 1024);
+    }
+    
+    @Test
+    public void basicTrimN2(AHashLookup<K> target) {
+        QAssert.assertThrows(IllegalArgumentException.class, () -> 
+            basicTrim(target, 5*32, 32, 1)
+        );
+    }
+    
+    private void basicTrim(AHashLookup<K> target, int put1st, int put2nd, int n) {
+        $map.urange(0, put1st).into(target);
+        target.clear();
+        $map.urange(0, put2nd).into(target);
+        target.trim(n);
+    }
+    
+}

+ 51 - 51
assira/src/test/java/net/ranides/assira/collection/suite/AHashMapTester.java

@@ -1,51 +1,51 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/???
- */
-package net.ranides.assira.collection.suite;
-
-import javax.annotation.Resource;
-import net.ranides.assira.collection.maps.AHashMap;
-import net.ranides.assira.collection.mockup.TMap;
-import net.ranides.assira.junit.QAssert;
-import org.junit.Test;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class AHashMapTester<K> {
-
-    @Resource
-    private TMap<K,Integer> $map;
-    
-    @Test
-    public void basicTrim(AHashMap<K, Integer> target) {
-        $map.put(target, $map.urange(0, 1024));
-        target.clear();
-        $map.put(target, $map.urange(0, 128));
-        target.trim();
-    }
-    
-    @Test
-    public void basicTrimN1(AHashMap<K, Integer> target) {
-        basicTrim(target, 5*32, 32, 1024);
-    }
-    
-    @Test
-    public void basicTrimN2(AHashMap<K, Integer>target) {
-        QAssert.assertThrows(IllegalArgumentException.class, () -> 
-            basicTrim(target, 5*32, 32, 1)
-        );
-    }
-    
-    private void basicTrim(AHashMap<K, Integer> target, int put1st, int put2nd, int n) {
-        $map.put(target, $map.urange(0, put1st));
-        target.clear();
-        $map.put(target, $map.urange(0, put2nd));
-        target.trim(n);
-    }
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.suite;
+
+import javax.annotation.Resource;
+import net.ranides.assira.collection.maps.AHashMap;
+import net.ranides.assira.collection.mockup.TMap;
+import net.ranides.assira.junit.QAssert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public final class AHashMapTester<K> {
+
+    @Resource(name = "map!")
+    private TMap<K,Integer> $map;
+    
+    @Test
+    public void basicTrim(AHashMap<K, Integer> target) {
+        $map.urange(0, 1024).into(target);
+        target.clear();
+        $map.urange(0, 128).into(target);
+        target.trim();
+    }
+    
+    @Test
+    public void basicTrimN1(AHashMap<K, Integer> target) {
+        basicTrim(target, 5*32, 32, 1024);
+    }
+    
+    @Test
+    public void basicTrimN2(AHashMap<K, Integer>target) {
+        QAssert.assertThrows(IllegalArgumentException.class, () -> 
+            basicTrim(target, 5*32, 32, 1)
+        );
+    }
+    
+    private void basicTrim(AHashMap<K, Integer> target, int put1st, int put2nd, int n) {
+        $map.urange(0, put1st).into(target);
+        target.clear();
+        $map.urange(0, put2nd).into(target);
+        target.trim(n);
+    }
+    
+}

+ 37 - 34
assira/src/test/java/net/ranides/assira/collection/suite/CollectionSuite.java

@@ -1,34 +1,37 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/???
- */
-package net.ranides.assira.collection.suite;
-
-import net.ranides.assira.collection.mockup.TPoint;
-import net.ranides.assira.junit.QTesterSuite;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class CollectionSuite {
-
-    private CollectionSuite() { }
-    
-    public static final QTesterSuite SUITE = new QTesterSuite(System.err)
-        .append(new LookupTester())
-        .append(new AHashLookupTester())
-        .append(new SortedLookupTester())
-        .append(new MapTester())
-        .append(new AHashMapTester())
-        .append(new SortedMapTester())
-        .param("$map", TPoint.STD_INT_MAP);
-    
-    public static final QTesterSuite INT_SUITE = new QTesterSuite(System.err)
-        .append(new IntMapTester())
-        .append(new IntSortedMapTester())
-        ;
-
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.suite;
+
+import net.ranides.assira.collection.mockup.TComparator;
+import net.ranides.assira.collection.mockup.TPoint;
+import net.ranides.assira.junit.QTesterSuite;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public final class CollectionSuite {
+
+    private CollectionSuite() { }
+    
+    public static final QTesterSuite SUITE = new QTesterSuite(System.err)
+        .append(new LookupTester())
+        .append(new AHashLookupTester())
+        .append(new SortedLookupTester())
+        .append(new MapTester())
+        .append(new AHashMapTester())
+        .append(new SortedMapTester())
+        .param("map!", TPoint.STD_INT_MAP)
+		.param("sum!", new TComparator<>(TPoint.SUM));
+		;
+    
+    public static final QTesterSuite INT_SUITE = new QTesterSuite(System.err)
+        .append(new IntMapTester())
+        .append(new IntSortedMapTester())
+        ;
+
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 556 - 556
assira/src/test/java/net/ranides/assira/collection/suite/IntMapTester.java


+ 331 - 331
assira/src/test/java/net/ranides/assira/collection/suite/LookupTester.java

@@ -1,331 +1,331 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/???
- */
-package net.ranides.assira.collection.suite;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import javax.annotation.Resource;
-import net.ranides.assira.collection.IntCollection;
-import net.ranides.assira.collection.iterators.IntIterator;
-import net.ranides.assira.collection.lookups.Lookup;
-import net.ranides.assira.collection.mockup.TMap;
-import net.ranides.assira.collection.mockup.TMap.TItem;
-import net.ranides.assira.collection.mockup.TMap.TItems;
-//import net.ranides.assira.collection.mockup.TPoint;
-//import net.ranides.assira.collection.mockup.ValueEnum;
-//import static net.ranides.assira.collection.mockup.ValueEnum.*;
-//import static net.ranides.assira.collection.mockup.TPointUtils.*;
-import net.ranides.assira.junit.QAssert;
-import static org.junit.Assert.*;
-import org.junit.Test;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-@SuppressWarnings("PMD.MethodNameRules")
-public final class LookupTester<K> {
-    
-    @Resource
-    private TMap<K,Integer> $map;
-    
-    private static final int BASIC_PUT_MANY = 128;
-    
-    private static final int BASIC_PUT_REPLACE = 40;
-    
-    private static final int BASIC_PUT_RANDOM = 220;
-    
-    private static final int BASIC_REMOVE_ALL = 97;
-    
-    private static final int BASIC_REMOVE_RANDOM = 273;
-    
-    @Test
-    public void basicPut(Lookup<K> target) {
-        int prev = target.size();
-        for(TItem<K,Integer> item :$map.range(0, BASIC_PUT_MANY)) {
-            target.put(item.key(), item.value());
-        }
-        assertEquals(prev + BASIC_PUT_MANY, target.size());
-        
-        logicPut(target);
-    }
-    
-    @Test
-    public void logicPut(Lookup<K> target) {
-        int prev = target.size();
-        TItem<K,Integer> item1 = $map.item(1);
-        TItem<K,Integer> item2 = $map.item(1).next();
-        target.put(item1.key(), item1.value());
-        assertEquals(prev + 1, target.size());
-        
-        target.put(item1.key(), item1.value());
-        assertEquals(prev + 1, target.size());
-        
-        target.put(item2.key(), item2.value()); // identical hash but not eq
-        assertEquals(prev + 2, target.size());
-    }
-    
-    @Test
-    public void basicPutReplace(Lookup<K> target) {
-        int prev = target.size();
-        for (TItem<K,Integer> item : $map.urange(0, BASIC_PUT_REPLACE)) {
-            target.put(item.key(), item.value());
-        }
-        assertEquals(prev + (2 * BASIC_PUT_REPLACE), target.size());
-    }
-	
-	@Test
-    public void basicPutRandom(Lookup<K> target) {
-        int prev = target.size();
-        for (TItem<K,Integer> item : $map.urange(0, BASIC_PUT_RANDOM)) {
-            target.put(item.key(), item.value());
-        }
-        assertEquals(prev + (2 * BASIC_PUT_RANDOM), target.size());
-    }
-	    
-    @Test
-    public void basicRemove(Lookup<K> target) {
-        target.defaultReturnValue(-1);
-        $map.put(target, $map.list(1,2,3));
-        
-        assertNotRemove(target, $map.item(1).next());
-        
-        assertRemove(target, $map.item(1).key(), $map.item(1).value());
-        assertRemove(target, $map.item(2).key(), $map.item(2).value());
-        assertRemove(target, $map.item(3).key(), $map.item(3).value());
-        
-        assertEquals(0, target.size());
-        
-        assertNotRemove(target, $map.item(3));
-    }
-    
-    @Test
-    public void basicRemoveAll(Lookup<K> target) {
-        assertEquals(0, target.size());
-        TItems<K,Integer> items = $map.range(0, BASIC_REMOVE_ALL);
-        
-        $map.put(target, items);
-        assertEquals(BASIC_REMOVE_ALL, target.size());
-        
-        for(int i=0; i<BASIC_REMOVE_ALL; i++) {
-            assertEquals(items.at(i).valueInt(), target.removeInt(items.at(i).key()));
-            assertEquals(BASIC_REMOVE_ALL-i-1, target.size());
-        }
-        assertEquals(0, target.size());
-    }
-    
-    @Test
-    public void basicRemoveRandom(Lookup<K> target) {
-        assertEquals(0, target.size());
-        TItems<K,Integer> items = $map.range(0, BASIC_REMOVE_RANDOM);
-        
-        $map.put(target, items);
-        assertEquals(BASIC_REMOVE_RANDOM, target.size());
-
-        items.shuffle(777);
-        for(int i=0; i<BASIC_REMOVE_RANDOM; i++) {
-            assertEquals(items.at(i).valueInt(), target.removeInt(items.at(i).key()));
-            assertEquals(BASIC_REMOVE_RANDOM-i-1, target.size());
-        }
-        assertEquals(0, target.size());
-    }
-    
-    @Test
-    public void basicGet(Lookup<K> target) {
-        assertEquals(0, target.getInt($map.item(1).key()));
-
-        $map.put(target, $map.list(1,2,3));
-        assertEquals(3, target.size());
-        assertEquals(0, target.getInt($map.item(1).next().key()));
-        
-        assertEquals($map.item(1).valueInt(), target.getInt($map.item(1).key()));
-        assertEquals($map.item(2).valueInt(), target.getInt($map.item(2).key()));
-        assertEquals($map.item(3).valueInt(), target.getInt($map.item(3).key()));
-    }
-    
-    @Test
-    public void logicRemove(Lookup<K> target) {
-        target.defaultReturnValue(-1);
-        $put(target, A1, B1, C1);
-        
-        assertEquals(-1, target.removeInt($key(A1_NE)));
-        assertEquals(3, target.size());
-
-        assertContains(target, A1_EQ, A1);
-        assertContains(target, A1, A1);
-        assertRemove(target, A1_EQ, A1);
-        assertNotContains(target, A1_EQ);
-        assertNotContains(target, A1);
-        
-        assertContains(target, B1, B1);
-        assertRemove(target, B1, B1);
-        assertNotContains(target, B1);
-        
-        assertContains(target, C1, C1);
-        assertRemove(target, C1, C1);
-        assertNotContains(target, C1);
-    }
-    
-    @Test
-    public void basicContains(Lookup<K> target) {
-        assertEquals(0, target.size());
-        $put(target, A1, B1);
-        
-        assertEquals(true, target.containsValue($value(A1)));
-        assertEquals(true, target.containsValue($value(B1)));
-        
-        assertEquals(false, target.containsValue($value(A1_EQ)));
-        assertEquals(false, target.containsValue($value(A1_NE)));
-        assertEquals(false, target.containsValue($value(C1)));
-    }
-    
-	@Test
-    public void basicEntrySet_Iterator(Lookup<K> target) {
-        Set<Lookup.LookupEntry<K>> set = target.fastEntrySet();
-		
-        assertEquals(0, set.size());
-		$put(target, A1, A1_NE, B1, C1);
-		assertEquals(4, set.size());
-        
-        Iterator<Lookup.LookupEntry<K>> iterator = set.iterator();
-        while(iterator.hasNext()) {
-            Lookup.LookupEntry<K> entry = iterator.next();
-            assertEquals(target.getInt(entry.getKey()), entry.getIntValue());
-        }
-        
-        QAssert.assertThrows(NoSuchElementException.class, ()-> iterator.next());
-	}
-    
-    @Test
-    public void basicEntrySet_Iterator_SetValue(Lookup<K> target) {
-        Set<Lookup.LookupEntry<K>> set = target.fastEntrySet();
-                
-		assertEquals(0, set.size());
-		$put(target, A1, A1_NE, B1, C1);
-		
-		Iterator<Lookup.LookupEntry<K>> iterator = set.iterator();
-		while(iterator.hasNext()) {
-			Lookup.LookupEntry<K> entry = iterator.next();
-			K key = entry.getKey();
-			if(TPoint.SUM.equals(key, $key(A1_EQ))) {
-                entry.setValue($value(D1));
-            }
-            if(TPoint.SUM.equals(key, $key(B1))) {
-                entry.setValue($value(D2));
-            }
-		}
-		assertContains(target, A1, D1);
-		assertContains(target, B1, D2);
-		assertContains(target, A1_NE, A1_NE);
-		assertContains(target, C1, C1);
-	}
-    
-    @Test
-    public void basicValues_Contains(Lookup<K> target) {
-        IntCollection set = target.values();
-		
-        assertEquals(0, set.size());
-		
-        $put(target, A1, A1_NE, B1, C1);
-		assertEquals(4, set.size());
-        assertEquals(true, set.contains($value(A1)));
-        assertEquals(true, set.contains($value(A1_NE)));
-        assertEquals(true, set.contains($value(B1)));
-        assertEquals(true, set.contains($value(C1)));
-        
-        assertEquals(false, set.contains($value(D1)));
-        assertEquals(false, set.contains(new Object()));
-	}
-    
-    @Test
-    public void basicValues_Remove(Lookup<K> target) {
-        IntCollection set = target.values();
-		
-        basicValues_Contains(target);
-		
-        assertEquals(true, set.remove($value(A1)));
-        assertEquals(false, set.remove($value(D1)));
-        assertEquals(false, set.remove(new Object()));
-        
-        assertEquals(false, set.contains($value(A1)));
-        assertEquals(true, set.contains($value(A1_NE)));
-        assertEquals(true, set.contains($value(B1)));
-        assertEquals(true, set.contains($value(C1)));
-	}
-   
-    @Test
-    public void basicValues_Iterator(Lookup<K> target) {
-        IntCollection set = target.values();
-		
-        assertEquals(0, set.size());
-		$put(target, A1, A1_NE, B1, C1);
-		assertEquals(4, set.size());
-
-        IntIterator iterator = set.iterator();
-        while(iterator.hasNext()) {
-            int var = iterator.next();
-            assertEquals(true, target.containsValue(var));
-        }
-        
-        QAssert.assertThrows(NoSuchElementException.class, ()-> iterator.next());
-	}
-    
-    @SuppressWarnings("unchecked")
-    @Test
-    public void basicValues_Iterator_Remove(Lookup<K> target) {
-        IntCollection set = target.values();
-        
-		assertEquals(0, set.size());
-		$put(target, A1, A1_NE, B1, C1);
-		
-		IntIterator iterator = set.iterator();
-		while(iterator.hasNext()) {
-			int var = iterator.next();
-			
-            if(var == $value(A1)) {
-                iterator.remove();
-            }
-            if(var == $value(B1)) {
-                iterator.remove();
-                QAssert.assertThrows(IllegalStateException.class, ()-> iterator.remove());
-            }
-		}
-        
-        assertEquals(2, target.size());
-        assertNotContains(target, A1);
-        assertNotContains(target, B1);
-		assertContains(target, A1_NE, A1_NE);
-		assertContains(target, C1, C1);
-        
-        set.clear();
-        assertEquals(0, target.size());
-	}
-        
-    private void assertRemove(Lookup<K> target, K key, Integer prev) {
-        int size = target.size();
-        assertEquals(prev.intValue(), target.removeInt(key));
-        assertEquals(size-1, target.size());
-    }
-    
-    private void assertNotRemove(Lookup<K> target, TItem<K,Integer> item) {
-        int size = target.size();
-        assertEquals(target.defaultReturnValue(), target.removeInt(item.key()));
-        assertEquals(size, target.size());
-    }
-    
-    private void assertContains(Lookup<K> target, TItem<K,Integer> item) {
-        assertEquals(true, target.containsKey(item.key()));
-        assertEquals(item.valueInt(), target.getInt(item.key()));
-    }
-    
-    private void assertNotContains(Lookup<K> target, TItem<K,Integer> item) {
-        assertEquals(false, target.containsKey(item.key()));
-        assertEquals(target.defaultReturnValue(), target.getInt(item.key()));
-    }
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/???
+ */
+package net.ranides.assira.collection.suite;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import javax.annotation.Resource;
+import net.ranides.assira.collection.IntCollection;
+import net.ranides.assira.collection.iterators.IntIterator;
+import net.ranides.assira.collection.lookups.Lookup;
+import net.ranides.assira.collection.mockup.TMap;
+import net.ranides.assira.collection.mockup.TMap.TItem;
+import net.ranides.assira.collection.mockup.TMap.TItems;
+import net.ranides.assira.collection.mockup.TComparator;
+import net.ranides.assira.junit.QAssert;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+@SuppressWarnings("PMD.MethodNameRules")
+public final class LookupTester<K> {
+    
+    @Resource(name = "map!")
+    private TMap<K,Integer> $map;
+	
+	@Resource(name = "sum!")
+    private TComparator<K,Integer> $sum;
+    
+    private static final int BASIC_PUT_MANY = 128;
+    
+    private static final int BASIC_PUT_REPLACE = 40;
+    
+    private static final int BASIC_PUT_RANDOM = 220;
+    
+    private static final int BASIC_REMOVE_ALL = 97;
+    
+    private static final int BASIC_REMOVE_RANDOM = 273;
+    
+    @Test
+    public void basicPut(Lookup<K> target) {
+        int prev = target.size();
+        for(TItem<K,Integer> item :$map.range(0, BASIC_PUT_MANY)) {
+            target.put(item.key(), item.value());
+        }
+        assertEquals(prev + BASIC_PUT_MANY, target.size());
+        
+        logicPut(target);
+    }
+    
+    @Test
+    public void logicPut(Lookup<K> target) {
+        int prev = target.size();
+        TItem<K,Integer> item1 = $map.item(1001,0);
+        TItem<K,Integer> item2 = $map.item(1001,1);
+        target.put(item1.key(), item1.value());
+        assertEquals(prev + 1, target.size());
+        
+        target.put(item1.key(), item1.value());
+        assertEquals(prev + 1, target.size());
+        
+        target.put(item2.key(), item2.value()); // identical hash but not eq
+        assertEquals(prev + 2, target.size());
+    }
+    
+    @Test
+    public void basicPutReplace(Lookup<K> target) {
+        int prev = target.size();
+        for (TItem<K,Integer> item : $map.urange(0, BASIC_PUT_REPLACE)) {
+            target.put(item.key(), item.value());
+        }
+        assertEquals(prev + (2 * BASIC_PUT_REPLACE), target.size());
+    }
+	
+	@Test
+    public void basicPutRandom(Lookup<K> target) {
+        int prev = target.size();
+        for (TItem<K,Integer> item : $map.urange(0, BASIC_PUT_RANDOM)) {
+            target.put(item.key(), item.value());
+        }
+        assertEquals(prev + (2 * BASIC_PUT_RANDOM), target.size());
+    }
+	    
+    @Test
+    public void basicRemove(Lookup<K> target) {
+        target.defaultReturnValue(-1);
+        $map.list(1,2,3).into(target);
+        
+        assertNotRemove(target, $map.item(1,1));
+        
+        assertRemove(target, $map.item(1));
+        assertRemove(target, $map.item(2));
+        assertRemove(target, $map.item(3));
+        
+        assertEquals(0, target.size());
+        
+        assertNotRemove(target, $map.item(3));
+    }
+    
+    @Test
+    public void basicRemoveAll(Lookup<K> target) {
+        assertEquals(0, target.size());
+        TItems<K,Integer> items = $map.range(0, BASIC_REMOVE_ALL);
+        
+        items.into(target);
+        assertEquals(BASIC_REMOVE_ALL, target.size());
+        
+        for(int i=0; i<BASIC_REMOVE_ALL; i++) {
+            assertEquals(items.at(i).valueInt(), target.removeInt(items.at(i).key()));
+            assertEquals(BASIC_REMOVE_ALL-i-1, target.size());
+        }
+        assertEquals(0, target.size());
+    }
+    
+    @Test
+    public void basicRemoveRandom(Lookup<K> target) {
+        assertEquals(0, target.size());
+        TItems<K,Integer> items = $map.range(0, BASIC_REMOVE_RANDOM);
+        
+        items.into(target);
+        assertEquals(BASIC_REMOVE_RANDOM, target.size());
+
+        items.shuffle(777);
+        for(int i=0; i<BASIC_REMOVE_RANDOM; i++) {
+            assertEquals(items.at(i).valueInt(), target.removeInt(items.at(i).key()));
+            assertEquals(BASIC_REMOVE_RANDOM-i-1, target.size());
+        }
+        assertEquals(0, target.size());
+    }
+    
+    @Test
+    public void basicGet(Lookup<K> target) {
+        assertEquals(0, target.getInt($map.item(1).key()));
+
+        $map.list(1,2,3).into(target);
+        assertEquals(3, target.size());
+        assertEquals(0, target.getInt($map.item(1,1).key()));
+        
+        assertEquals($map.item(1).valueInt(), target.getInt($map.item(1).key()));
+        assertEquals($map.item(2).valueInt(), target.getInt($map.item(2).key()));
+        assertEquals($map.item(3).valueInt(), target.getInt($map.item(3).key()));
+    }
+    
+    @Test
+    public void logicRemove(Lookup<K> target) {
+        target.defaultReturnValue(-1);
+		$map.list(1,2,3).into(target);
+        
+        assertEquals(-1, target.removeInt($map.item(1,1).key()));
+        assertEquals(3, target.size());
+		
+        assertContains(target, $map.item(1));
+        assertRemove(target, $map.item(1));
+        assertNotContains(target, $map.item(1));
+        
+        assertContains(target, $map.item(2));
+        assertRemove(target, $map.item(2));
+        assertNotContains(target, $map.item(2));
+        
+        assertContains(target, $map.item(3));
+        assertRemove(target, $map.item(3));
+        assertNotContains(target, $map.item(3));
+    }
+    
+    @Test
+    public void basicContains(Lookup<K> target) {
+        assertEquals(0, target.size());
+		$map.list(1,2).into(target);
+        
+        assertEquals(true, target.containsValue($map.item(1).value()));
+        assertEquals(true, target.containsValue($map.item(2).value()));
+        
+        assertEquals(false, target.containsValue($map.item(1,1).value()));
+        assertEquals(false, target.containsValue($map.item(3).value()));
+    }
+    
+	@Test
+    public void basicEntrySet_Iterator(Lookup<K> target) {
+        Set<Lookup.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<Lookup.LookupEntry<K>> iterator = set.iterator();
+        while(iterator.hasNext()) {
+            Lookup.LookupEntry<K> entry = iterator.next();
+            assertEquals(target.getInt(entry.getKey()), entry.getIntValue());
+        }
+        
+        QAssert.assertThrows(NoSuchElementException.class, ()-> iterator.next());
+	}
+    
+    @Test
+    public void basicEntrySet_Iterator_SetValue(Lookup<K> target) {
+        Set<Lookup.LookupEntry<K>> set = target.fastEntrySet();
+                
+		assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+		
+		Iterator<Lookup.LookupEntry<K>> iterator = set.iterator();
+		while(iterator.hasNext()) {
+			Lookup.LookupEntry<K> entry = iterator.next();
+			if($sum.equals(entry, $map.item(1))) {
+				entry.setValue(667);
+			}
+			if($sum.equals(entry, $map.item(2))) {
+				entry.setValue(668);
+			}
+		}
+		assertContains(target, $map.item(1).key(), 667);
+		assertContains(target, $map.item(2).key(), 668);
+		assertContains(target, $map.item(1,1));
+		assertContains(target, $map.item(3));
+	}
+    
+    @Test
+    public void basicValues_Contains(Lookup<K> target) {
+        IntCollection set = target.values();
+		
+        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).value()));
+        assertEquals(true, set.contains($map.item(1,1).value()));
+        assertEquals(true, set.contains($map.item(2).value()));
+        assertEquals(true, set.contains($map.item(3).value()));
+        
+        assertEquals(false, set.contains($map.item(4).value()));
+        assertEquals(false, set.contains(new Object()));
+	}
+    
+    @Test
+    public void basicValues_Remove(Lookup<K> target) {
+        IntCollection set = target.values();
+		
+        basicValues_Contains(target);
+		
+        assertEquals(true, set.remove($map.item(1).value()));
+        assertEquals(false, set.remove($map.item(4).value()));
+        assertEquals(false, set.remove(new Object()));
+        
+        assertEquals(false, set.contains($map.item(1).value()));
+        assertEquals(true, set.contains($map.item(1,1).value()));
+        assertEquals(true, set.contains($map.item(2).value()));
+        assertEquals(true, set.contains($map.item(3).value()));
+	}
+   
+    @Test
+    public void basicValues_Iterator(Lookup<K> target) {
+        IntCollection set = target.values();
+		
+        assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+		assertEquals(4, set.size());
+
+        IntIterator iterator = set.iterator();
+        while(iterator.hasNext()) {
+            int var = iterator.next();
+            assertEquals(true, target.containsValue(var));
+        }
+        
+        QAssert.assertThrows(NoSuchElementException.class, ()-> iterator.next());
+	}
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void basicValues_Iterator_Remove(Lookup<K> target) {
+        IntCollection set = target.values();
+        
+		assertEquals(0, set.size());
+		$map.list().item(1).item(1,1).item(2).item(3).into(target);
+		
+		IntIterator iterator = set.iterator();
+		while(iterator.hasNext()) {
+			int var = iterator.next();
+			
+            if(var == $map.item(1).value()) {
+                iterator.remove();
+            }
+            if(var == $map.item(2).value()) {
+                iterator.remove();
+                QAssert.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());
+	}
+        
+    private void assertRemove(Lookup<K> target, TItem<K,Integer> item) {
+        int size = target.size();
+        assertEquals(item.valueInt(), target.removeInt(item.key()));
+        assertEquals(size-1, target.size());
+    }
+    
+    private void assertNotRemove(Lookup<K> target, TItem<K,Integer> item) {
+        int size = target.size();
+        assertEquals(target.defaultReturnValue(), target.removeInt(item.key()));
+        assertEquals(size, target.size());
+    }
+	
+	private void assertContains(Lookup<K> target, K key, int value) {
+        assertEquals(true, target.containsKey(key));
+        assertEquals(value, target.getInt(key));
+    }
+    
+    private void assertContains(Lookup<K> target, TItem<K,Integer> item) {
+		assertContains(target, item.key(), item.value());
+    }
+    
+    private void assertNotContains(Lookup<K> target, TItem<K,Integer> item) {
+        assertEquals(false, target.containsKey(item.key()));
+        assertEquals(target.defaultReturnValue(), target.getInt(item.key()));
+    }
+    
+}