public void TestSimpleInserts() { RTree tree = new RTree(4, 2); tree.Insert<int>(new Box(0, 0, 10, 10), 1); tree.ThrowOnInvariantsViolated(); tree.Insert<int>(new Box(20, 0, 30, 10), 2); tree.ThrowOnInvariantsViolated(); AssertSetIsEqual(tree.Find<int>(new Box(-5, -5, 5, 5)), 1); // Cause the first split: tree.Insert<int>(new Box(20, 0, 30, 10), 3); tree.ThrowOnInvariantsViolated(); tree.Insert<int>(new Box(20, 20, 30, 30), 4); tree.ThrowOnInvariantsViolated(); tree.Insert<int>(new Box(40, 0, 50, 30), 5); tree.ThrowOnInvariantsViolated(); AssertSetIsEqual(tree.Find<int>(new Box(-5, -5, 5, 5)), 1); AssertSetIsEqual(tree.Find<int>(new Box(5, 5, 25, 25)), 1, 2, 3, 4); AssertSetIsEqual(tree.Find<int>(new Box(-1000, -1000, 1000, 1000)), 1, 2, 3, 4, 5); // Cause another set of splits: for (int i = 0; i < 1000; i++) { tree.Insert<int>(new Box(100 + i * 10, 0, 100 + i * 10 + 10, 10), 6 + i); tree.ThrowOnInvariantsViolated(); } AssertSetIsEqual(tree.Find<int>(new Box(-5, -5, 5, 5)), 1); AssertSetIsEqual(tree.Find<int>(new Box(5, 5, 25, 25)), 1, 2, 3, 4); AssertSetIsEqual(tree.Find<int>(new Box(-1000, -1000, 45, 1000)), 1, 2, 3, 4, 5); }