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