Program: 35277
Project: 35277
Buggy source:
@Test public void test64_True1D_queries_PositiveNumbers(){
  final int K=1;
  for (int r=0; r < 100; r++) {
    Random R=new Random(r);
    int N=5;
    long[][] aa=new long[N][];
    CritBit<Integer> cb=newCritBit(64);
    for (int i=0; i < N; i++) {
      long[] a=new long[K];
      for (int k=0; k < K; k++) {
        a[k]=Math.abs(R.nextLong());
      }
      if (cb.contains(a)) {
        i--;
        continue;
      }
      aa[i]=a;
      assertNull(cb.insert(a,i));
      assertTrue(cb.contains(a));
    }
    assertEquals(N,cb.size());
    long[] qMin=new long[K];
    long[] qMax=new long[K];
    Iterator<long[]> it=null;
    for (int i=0; i < 10; i++) {
      createQueryAbs(R,qMin,qMax);
      ArrayList<long[]> result=executeQuery(aa,qMin,qMax);
      it=cb.query(qMin,qMax);
      int nResult=0;
      System.out.println("String_Node_Str" + BitTools.toBinary(qMin[0],64));
      System.out.println("String_Node_Str" + BitTools.toBinary(qMax[0],64));
      while (it.hasNext()) {
        long[] ra=it.next();
        nResult++;
        assertContains(aa,ra);
        System.out.println("String_Node_Str" + BitTools.toBinary(ra[0],64));
      }
      assertEquals("String_Node_Str" + r + "String_Node_Str"+ i,result.size(),nResult);
    }
    int n=0;
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMin,qMax);
    while (it.hasNext()) {
      it.next();
      n++;
    }
    assertEquals(N,n);
    for (    long[] a : aa) {
      it=cb.query(a,a);
      assertTrue(it.hasNext());
      long[] r2=it.next();
      assertFalse(it.hasNext());
      assertTrue(isEqual(a,r2));
    }
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMax,qMin);
    assertFalse(it.hasNext());
    for (int i=0; i < N; i++) {
      assertEquals(i,(int)cb.remove(aa[i]));
    }
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMin,qMax);
    assertFalse(it.hasNext());
  }
}

Fixed version (ground truth):
@Test public void test64_True1D_queries_PositiveNumbers(){
  final int K=1;
  for (int r=0; r < 1000; r++) {
    Random R=new Random(r);
    int N=1000;
    long[][] aa=new long[N][];
    CritBit<Integer> cb=newCritBit(64);
    for (int i=0; i < N; i++) {
      long[] a=new long[K];
      for (int k=0; k < K; k++) {
        a[k]=Math.abs(R.nextLong());
      }
      if (cb.contains(a)) {
        i--;
        continue;
      }
      aa[i]=a;
      assertNull(cb.insert(a,i));
      assertTrue(cb.contains(a));
    }
    assertEquals(N,cb.size());
    long[] qMin=new long[K];
    long[] qMax=new long[K];
    Iterator<long[]> it=null;
    for (int i=0; i < 10; i++) {
      createQueryAbs(R,qMin,qMax);
      ArrayList<long[]> result=executeQuery(aa,qMin,qMax);
      it=cb.query(qMin,qMax);
      int nResult=0;
      while (it.hasNext()) {
        long[] ra=it.next();
        nResult++;
        assertContains(aa,ra);
      }
      assertEquals("String_Node_Str" + r + "String_Node_Str"+ i,result.size(),nResult);
    }
    int n=0;
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMin,qMax);
    while (it.hasNext()) {
      it.next();
      n++;
    }
    assertEquals(N,n);
    for (    long[] a : aa) {
      it=cb.query(a,a);
      assertTrue(it.hasNext());
      long[] r2=it.next();
      assertFalse(it.hasNext());
      assertTrue(isEqual(a,r2));
    }
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMax,qMin);
    assertFalse(it.hasNext());
    for (int i=0; i < N; i++) {
      assertEquals(i,(int)cb.remove(aa[i]));
    }
    Arrays.fill(qMin,Long.MIN_VALUE);
    Arrays.fill(qMax,Long.MAX_VALUE);
    it=cb.query(qMin,qMax);
    assertFalse(it.hasNext());
  }
}