public void testClone() { for (int s = 0; s < 2; s++) { IntTree it = initIntTree(s); IntTree it2 = new IntTree(); it2.clone(it); assertEquals(it.size(), it2.size()); for (int i = 0; i < it.size(); i++) { assertEquals( ((Integer) it.get(ranNums[i])).intValue(), ((Integer) it2.get(ranNums[i])).intValue()); } for (int i = 0; i < it.size(); i++) { assertEquals(it.getKeyIdx(i), it2.getKeyIdx(i)); } for (int i = 0; i < it.size(); i++) { assertEquals(it.getValueIdx(i), it2.getValueIdx(i)); } } }
public void testGetValueIdx() { for (int s = 0; s < 1; s++) { // Don't use random ordering as may // contain duplicates IntTree it = initIntTree(s); int[] sortRanNums = ranNums.clone(); Arrays.sort(sortRanNums); for (int i = 0; i < sortRanNums.length; i++) { assertEquals( "Key of idx " + i + " was not as expected", new Integer(sortRanNums[i]), it.getValueIdx(i)); } } }