public void testConstructors() {
int[] keys = {1138, 42, 86, 99, 101};
long[] vals = {1138, 42, 86, 99, 101};
TIntLongMap map = new TIntLongHashMap();
for ( int i = 0; i < keys.length; i++ ) {
map.put( keys[i], vals[i] );
}
assertEquals( keys.length, map.size() );
TIntLongMap capacity = new TIntLongHashMap( 20 );
for ( int i = 0; i < keys.length; i++ ) {
capacity.put( keys[i], vals[i] );
}
assertEquals( keys.length, capacity.size() );
TIntLongMap cap_and_factor = new TIntLongHashMap( 20, 0.75f );
for ( int i = 0; i < keys.length; i++ ) {
cap_and_factor.put( keys[i], vals[i] );
}
assertEquals( keys.length, cap_and_factor.size() );
TIntLongMap fully_specified =
new TIntLongHashMap( 20, 0.5f, Integer.MIN_VALUE, Long.MIN_VALUE );
for ( int i = 0; i < keys.length; i++ ) {
fully_specified.put( keys[i], vals[i] );
}
assertEquals( keys.length, fully_specified.size() );
TIntLongMap copy = new TIntLongHashMap( map );
assertEquals( keys.length, fully_specified.size() );
TIntLongMap arrays = new TIntLongHashMap( keys, vals );
assertEquals( keys.length, arrays.size() );
// Equals in all combinations is paranoid.. but..
assertEquals( map, map );
assertEquals( map, capacity );