@Test public void tree_ins_2_04() { int[] keys = {0, 9, 2, 7, 4, 5, 6, 3, 8, 1}; RangeIndex rIndex = makeRangeIndex(2); testInsert(rIndex, keys); assertEquals(0, r(rIndex.minKey())); assertEquals(9, r(rIndex.maxKey())); }
@Test public void tree_ins_2_02() { int[] keys = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; RangeIndex rIndex = makeRangeIndex(2); testInsert(rIndex, keys); assertEquals(0, r(rIndex.minKey())); assertEquals(9, r(rIndex.maxKey())); }
@Test public void tree_ins_0_1() { int[] keys = {0, 1, 2}; RangeIndex rIndex = makeRangeIndex(2); testInsert(rIndex, keys); assertFalse(rIndex.isEmpty()); assertEquals(0, r(rIndex.minKey())); assertEquals(2, r(rIndex.maxKey())); }
protected void testClear(int N) { int[] keys = new int[N]; // Slice is 1000. for (int i = 0; i < keys.length; i++) keys[i] = i; RangeIndex rIndex = makeRangeIndex(3); add(rIndex, keys); if (N > 0) assertFalse(rIndex.isEmpty()); rIndex.clear(); assertTrue(rIndex.isEmpty()); }
@Test public void tree_iter_0_05() { int[] keys = {1, 2, 3, 4, 5}; RangeIndex rIndex = makeRangeIndex(5); add(rIndex, keys); List<Integer> x = toIntList(rIndex.iterator(r(1), r(0))); List<Integer> expected = toIntList(); assertEquals(expected, x); }
@Test public void tree_iter_2_09() { int[] keys = {1, 2, 3, 4, /* 5, 6, */ 7, 8, 9, 10, 11}; RangeIndex rIndex = makeRangeIndex(2); add(rIndex, keys); List<Integer> x = toIntList(rIndex.iterator(r(5), r(7))); List<Integer> expected = toIntList(); assertEquals(expected, x); }
@Test public void tree_iter_2_08() { int[] keys = {1, 2, 3, 4, 5, 6, 7, 8, 9}; RangeIndex rIndex = makeRangeIndex(2); add(rIndex, keys); List<Integer> x = toIntList(rIndex.iterator(r(0), r(99))); List<Integer> expected = toIntList(keys); assertEquals(expected, x); }
@Test public void tree_iter_2_01() { int[] keys = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; RangeIndex rIndex = makeRangeIndex(2); add(rIndex, keys); List<Integer> x = toIntList(rIndex.iterator(r(4), r(6))); List<Integer> expected = toIntList(4, 5); assertEquals(expected, x); }
@Test public void tree_ins_0_0() { // Empty tree int[] keys = {}; RangeIndex rIndex = makeRangeIndex(2); testInsert(rIndex, keys); assertTrue(rIndex.isEmpty()); assertNull(rIndex.minKey()); assertNull(rIndex.maxKey()); }
@Test public void tree_ret_2() { int[] keys = {1, 2, 3, 4, 5}; RangeIndex rIndex = makeRangeIndex(2); add(rIndex, keys); boolean b = rIndex.delete(intToRecord(9)); assertFalse(b); b = rIndex.insert(intToRecord(1)); assertFalse(b); }
// Root @Test public void tree_iter_0_01() { int[] keys = {1, 2, 3, 4, 5}; RangeIndex rIndex = makeRangeIndex(5); add(rIndex, keys); Iterator<Record> iter = rIndex.iterator(r(2), r(4)); while (iter.hasNext()) iter.next(); List<Integer> x = toIntList(rIndex.iterator(r(2), r(4))); List<Integer> expected = toIntList(2, 3); assertEquals(expected, x); }
@Test public void tree_ins_2_05() { int[] keys = {0, 18, 4, 14, 8, 10, 12, 6, 16, 2}; RangeIndex rIndex = makeRangeIndex(2); testInsert(rIndex, keys); assertFalse(rIndex.contains(r(1))); assertFalse(rIndex.contains(r(999))); assertFalse(rIndex.contains(r(-9))); assertFalse(rIndex.contains(r(7))); assertEquals(0, r(rIndex.minKey())); assertEquals(18, r(rIndex.maxKey())); }