use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method testToString.
// @Test
// public void testHashCode()
// {
// Assert.assertEquals(
// UnifiedMap.newWithKeysValues(0L, 0L, 1L, 1L, 32L, 32L).hashCode(),
// this.newWithKeysValues(32L, 32L, 0L, 0L, 1L, 1L).hashCode());
// Assert.assertEquals(
// UnifiedMap.newWithKeysValues(50L, 0L, 60L, 1L, 70L, 33L).hashCode(),
// this.newWithKeysValues(50L, 0L, 60L, 1L, 70L, 33L).hashCode());
// Assert.assertEquals(UnifiedMap.newMap().hashCode(), this.getEmptyMap().hashCode());
// Assert.assertEquals(UnifiedMap.newWithKeysValues(1L, 2L).hashCode(), this.newWithKeysValues(1L, 2L).hashCode());
// }
@Test
public void testToString() {
Assert.assertEquals("{}", this.getEmptyMap().toString());
Assert.assertEquals("{0=0}", this.newWithKeysValues(0L, 0L).toString());
Assert.assertEquals("{1=1}", this.newWithKeysValues(1L, 1L).toString());
Assert.assertEquals("{5=5}", this.newWithKeysValues(5L, 5L).toString());
LongLongMap map1 = this.newWithKeysValues(0L, 0L, 1L, 1L);
Assert.assertTrue(map1.toString(), "{0=0, 1=1}".equals(map1.toString()) || "{1=1, 0=0}".equals(map1.toString()));
LongLongMap map2 = this.newWithKeysValues(1L, 1L, 32L, 32L);
Assert.assertTrue(map2.toString(), "{1=1, 32=32}".equals(map2.toString()) || "{32=32, 1=1}".equals(map2.toString()));
LongLongMap map3 = this.newWithKeysValues(0L, 0L, 32L, 32L);
Assert.assertTrue(map3.toString(), "{0=0, 32=32}".equals(map3.toString()) || "{32=32, 0=0}".equals(map3.toString()));
LongLongMap map4 = this.newWithKeysValues(32L, 32L, 33L, 33L);
Assert.assertTrue(map4.toString(), "{32=32, 33=33}".equals(map4.toString()) || "{33=33, 32=32}".equals(map4.toString()));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method values.
@Test
public void values() {
Verify.assertEmpty(this.getEmptyMap().values());
LongLongMap map = this.newWithKeysValues(0L, 0L);
Verify.assertSize(1, map.values());
Assert.assertTrue(map.values().contains(0L));
LongLongMap map1 = this.newWithKeysValues(0L, 0L, 31L, 31L, 32L, 32L);
Verify.assertSize(3, map1.values());
Assert.assertTrue(map1.values().contains(0L));
Assert.assertTrue(map1.values().contains(31L));
Assert.assertTrue(map1.values().contains(32L));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method count.
@Test
public void count() {
LongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
Assert.assertEquals(2, map.count(LongPredicates.greaterThan(1L)));
Assert.assertEquals(2, map.count(LongPredicates.lessThan(2L)));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method anySatisfy.
@Test
public void anySatisfy() {
LongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
Assert.assertFalse(this.getEmptyMap().anySatisfy(LongPredicates.equal(0L)));
Assert.assertFalse(this.newWithKeysValues(1L, 1L).anySatisfy(LongPredicates.equal(0L)));
Assert.assertTrue(this.newWithKeysValues(1L, 1L).anySatisfy(LongPredicates.equal(1L)));
Assert.assertTrue(map.anySatisfy(LongPredicates.equal(0L)));
Assert.assertTrue(map.anySatisfy(LongPredicates.equal(1L)));
Assert.assertTrue(map.anySatisfy(LongPredicates.equal(2L)));
Assert.assertFalse(map.anySatisfy(LongPredicates.greaterThan(5L)));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method forEachValue.
@Test
public void forEachValue() {
LongLongMap map0 = this.newWithKeysValues(0L, 1L, 3L, 4L);
long[] sum0 = new long[1];
map0.forEachValue(each -> sum0[0] += each);
Assert.assertEquals(5L, sum0[0]);
LongLongMap map1 = this.newWithKeysValues(1L, 2L, 3L, 4L);
long[] sum1 = new long[1];
map1.forEachValue(each -> sum1[0] += each);
Assert.assertEquals(6L, sum1[0]);
LongLongMap map01 = this.newWithKeysValues(0L, 1L, 1L, 2L);
long[] sum01 = new long[1];
map01.forEachValue(each -> sum01[0] += each);
Assert.assertEquals(3L, sum01[0]);
LongLongMap map = this.newWithKeysValues(3L, 4L, 4L, 5L);
long[] sum = new long[1];
map.forEachValue(each -> sum[0] += each);
Assert.assertEquals(9L, sum[0]);
LongLongMap map2 = this.getEmptyMap();
long[] sum2 = new long[1];
map2.forEachValue(each -> sum2[0] += each);
Assert.assertEquals(0L, sum2[0]);
LongLongMap map3 = this.newWithKeysValues(1L, 2L);
long[] sum3 = new long[1];
map3.forEachValue(each -> sum3[0] += each);
Assert.assertEquals(2L, sum3[0]);
}
Aggregations