コード例 #1
0
ファイル: IntTreeTests.java プロジェクト: kongx73/sharenav
  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));
      }
    }
  }
コード例 #2
0
ファイル: IntTreeTests.java プロジェクト: kongx73/sharenav
 public void testGetKeyIdx() {
   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", sortRanNums[i], it.getKeyIdx(i));
     }
   }
 }