public virtual void Test1() { var size = 100000; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(50); for (var i = 0; i < size; i++) { if (i % 10000 == 0) { Println(i); } tree.Insert(i + 1, "value " + (i + 1)); } AssertEquals(size, tree.GetSize()); IEnumerator iterator = new BTreeIteratorMultipleValuesPerKey <object>(tree, OrderByConstants.OrderByAsc); var j = 0; while (iterator.MoveNext()) { var o = iterator.Current; // println(o); j++; if (j == size) { AssertEquals("value " + size, o); } } }
public virtual void Test3() { var size = 100000; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2); for (var i = 0; i < size; i++) { // println(i); tree.Insert((i + 1).ToString(), "value " + (i + 1)); } AssertEquals(size, tree.GetSize()); var iterator = tree.Iterator <object>(OrderByConstants.OrderByAsc); var j = 0; while (iterator.MoveNext()) { var o = iterator.Current; // println(o); j++; if (j == size) { AssertEquals("value " + (size - 1), o); } } }
public virtual void TestNonUniqueKey() { var degree = 3; IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree); tree1.Insert(1, "A"); tree1.Insert(1, "AA"); tree1.Insert(1, "AAA"); AssertEquals(3, tree1.Search(1).Count); AssertEquals("A", tree1.Search(1)[0].ToString()); AssertEquals("AA", tree1.Search(1)[1].ToString()); AssertEquals("AAA", tree1.Search(1)[2].ToString()); AssertEquals(3, tree1.GetSize()); }
public virtual void Test2SameKey() { var size = 1000; var size2 = 100; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(50); for (var i = 0; i < size; i++) { if (i % 10000 == 0) Println(i); tree.Insert(i + 1, "value " + (i + 1)); } for (var i = 0; i < size2; i++) tree.Insert(100, "value " + (i + 1)); AssertEquals(size + size2, tree.GetSize()); }
public virtual void Test2() { var size = 100000; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2); for (var i = 0; i < size; i++) tree.Insert(i + 1, "value " + (i + 1)); AssertEquals(size, tree.GetSize()); var iterator = tree.Iterator<object>(OrderByConstants.OrderByDesc); var j = 0; while (iterator.MoveNext()) { var o = iterator.Current; // println(o); j++; if (j == size) AssertEquals("value " + 1, o); } }
public virtual void Test2SameKey() { var size = 1000; var size2 = 100; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(50); for (var i = 0; i < size; i++) { if (i % 10000 == 0) { Println(i); } tree.Insert(i + 1, "value " + (i + 1)); } for (var i = 0; i < size2; i++) { tree.Insert(100, "value " + (i + 1)); } AssertEquals(size + size2, tree.GetSize()); }
public virtual void Test3() { var size = 10; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(5); for (var i = 0; i < size; i++) { Println(i); tree.Insert(i + 1, "value " + (i + 1)); } AssertEquals(size, tree.GetSize()); IEnumerator iterator = new BTreeIteratorMultipleValuesPerKey<object>(tree, OrderByConstants.OrderByAsc); var j = 0; while (iterator.MoveNext()) { var o = iterator.Current; Console.WriteLine(o); j++; if (j == size) AssertEquals("value " + size, o); } }
public virtual void Test1() { var size = 100; IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2); for (var i = 0; i < size; i++) { tree.Insert(i + 1, "value " + (i + 1)); } AssertEquals(size, tree.GetSize()); var iterator = tree.Iterator <object>(OrderByConstants.OrderByAsc); var j = 0; while (iterator.MoveNext()) { var o = iterator.Current; j++; AssertEquals("value " + j, o); if (j == size) { AssertEquals("value " + size, o); } } }
public virtual void TestNonUniqueKey2() { var degree = 3; IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree); tree1.Insert(1, "A"); tree1.Insert(1, "AA"); tree1.Insert(1, "AAA"); tree1.Insert(1, "BBB"); var c = tree1.Search(1); AssertEquals(4, c.Count); var iterator = c.GetEnumerator(); iterator.MoveNext(); AssertEquals("A", iterator.Current); iterator.MoveNext(); AssertEquals("AA", iterator.Current); AssertEquals(4, tree1.GetSize()); AssertEquals("A", c[0].ToString()); AssertEquals("AA", c[1].ToString()); AssertEquals("AAA", c[2].ToString()); AssertEquals("BBB", c[3].ToString()); }