use of org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method addToValue.
@Test
public void addToValue() {
MutableLongLongMap map1 = this.getEmptyMap();
Assert.assertEquals(1L, map1.addToValue(0L, 1L));
Assert.assertEquals(32L, map1.addToValue(31L, 32L));
Assert.assertEquals(3L, map1.addToValue(1L, 3L));
Assert.assertEquals(11L, map1.addToValue(0L, 10L));
Assert.assertEquals(12L, map1.addToValue(1L, 9L));
Assert.assertEquals(37L, map1.addToValue(31L, 5L));
Assert.assertEquals(33L, map1.addToValue(32L, 33L));
LongLongHashMap expected = LongLongHashMap.newWithKeysValues(0L, 11L, 1L, 12L, 31L, 37L, 32L, 33L);
Assert.assertEquals(expected, map1);
map1.removeKey(0L);
map1.removeKey(1L);
map1.removeKey(31L);
map1.removeKey(32L);
Assert.assertEquals(5L, map1.addToValue(31L, 5L));
Assert.assertEquals(37L, map1.addToValue(31L, 32L));
Assert.assertEquals(33L, map1.addToValue(32L, 33L));
Assert.assertEquals(3L, map1.addToValue(1L, 3L));
Assert.assertEquals(1L, map1.addToValue(0L, 1L));
Assert.assertEquals(12L, map1.addToValue(1L, 9L));
Assert.assertEquals(11L, map1.addToValue(0L, 10L));
Assert.assertEquals(expected, map1);
}
use of org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method remove.
@Test
public void remove() {
MutableLongLongMap map0 = this.newWithKeysValues(0L, 0L, 1L, 1L);
map0.remove(1L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 0L), map0);
map0.remove(0L);
Assert.assertEquals(new LongLongHashMap(), map0);
MutableLongLongMap map1 = this.newWithKeysValues(0L, 0L, 1L, 1L);
map1.remove(0L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(1L, 1L), map1);
map1.remove(1L);
Assert.assertEquals(new LongLongHashMap(), map1);
MutableLongLongMap map2 = this.classUnderTest();
map2.remove(5L);
map2.remove(50L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 0L, 31L, 31L, 32L, 32L), map2);
map2.remove(0L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(31L, 31L, 32L, 32L), map2);
map2.remove(31L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(32L, 32L), map2);
map2.remove(32L);
Assert.assertEquals(new LongLongHashMap(), map2);
map2.remove(0L);
map2.remove(31L);
map2.remove(32L);
Assert.assertEquals(new LongLongHashMap(), map2);
Verify.assertEmpty(map2);
map2.put(AbstractMutableLongLongMapTestCase.generateCollisions().get(0), 1L);
map2.put(AbstractMutableLongLongMapTestCase.generateCollisions().get(1), 2L);
Assert.assertEquals(1L, map2.get(AbstractMutableLongLongMapTestCase.generateCollisions().get(0)));
map2.remove(AbstractMutableLongLongMapTestCase.generateCollisions().get(0));
Assert.assertEquals(0L, map2.get(AbstractMutableLongLongMapTestCase.generateCollisions().get(0)));
Assert.assertEquals(2L, map2.get(AbstractMutableLongLongMapTestCase.generateCollisions().get(1)));
map2.remove(AbstractMutableLongLongMapTestCase.generateCollisions().get(1));
Assert.assertEquals(0L, map2.get(AbstractMutableLongLongMapTestCase.generateCollisions().get(1)));
}
use of org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method clear.
@Test
public void clear() {
MutableLongLongMap map1 = this.classUnderTest();
map1.clear();
Assert.assertEquals(new LongLongHashMap(), map1);
map1.put(1L, 0L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(1L, 0L), map1);
map1.clear();
Assert.assertEquals(new LongLongHashMap(), map1);
map1.put(33L, 0L);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(33L, 0L), map1);
map1.clear();
Assert.assertEquals(new LongLongHashMap(), map1);
}
Aggregations