Skip to content

Instantly share code, notes, and snippets.

@bitkid bitkid/gist:5854451
Created Jun 24, 2013

Embed
What would you like to do?
import gnu.trove.map.TIntLongMap;
import gnu.trove.map.hash.TIntLongHashMap;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class TroveMapsEqualsTest {
@Test
public void testTIntLongMapEquals() {
assertEquals(MIL(0, 0), MIL(0, 0));
assertNotEquals(MIL(0, 1), MIL(0, 0));
assertNotEquals(MIL(1, 0), MIL(0, 0));
assertEquals(MIL(0, 1), MIL(0, 1));
assertNotEquals(MIL(1, 0), MIL(0, 1));
assertNotEquals(MIL(0, 0), MIL(0, 1));
assertEquals(MIL(1, 0), MIL(1, 0));
assertNotEquals(MIL(0, 0), MIL(1, 0));
assertNotEquals(MIL(0, 1), MIL(1, 0));
assertEquals(MIL(1, 1), MIL(1, 1));
assertNotEquals(MIL(1, 0), MIL(1, 1));
assertNotEquals(MIL(0, 1), MIL(1, 1));
assertNotEquals(MIL(0, 0), MIL(1, 1));
assertEquals(new TIntLongHashMap(), new TIntLongHashMap());
}
public static TIntLongMap MIL(long... elements) {
int hashSize = elements.length / 2;
TIntLongMap result = new TIntLongHashMap(hashSize);
for (int i = 0; i < hashSize; i++) {
//noinspection unchecked
result.put((int) elements[i * 2], elements[i * 2 + 1]);
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.