public void SimpleAABBTree_RemoveRebuildCheck() { SimpleAABBTree myATree = new SimpleAABBTree(); SimpleAABBTree myBTree = new SimpleAABBTree(); BoundingBox myBox; int TESTCOUNT = 20; SimpleAABBTreeDynamicInstance myObjectToRemove = null; for (int i = 0; i < TESTCOUNT; i++) { var myEntity = new SimpleAABBTreeDynamicInstance(new BoundingBox(new Vector3(myRandom.Next(-100, 0), myRandom.Next(-100, 0), myRandom.Next(-100, 0)), new Vector3(myRandom.Next(1, 100), myRandom.Next(1, 100), myRandom.Next(1, 100)))); if (i + 1 != TESTCOUNT) { myATree.Insert(myEntity); } else { myObjectToRemove = myEntity; } myBTree.Insert(myEntity); } myBTree.Remove(myObjectToRemove); myBTree.Rebuild(); Assert.AreEqual(myATree.CompareTo(myBTree), 0); }
public void SimpleAABBTree_CompareToCheck_SameTree() { SimpleAABBTree myATree = new SimpleAABBTree(); SimpleAABBTree myBTree = new SimpleAABBTree(); BoundingBox myBox; int TESTCOUNT = 20; for (int i = 0; i < TESTCOUNT; i++) { var myEntity = new SimpleAABBTreeDynamicInstance(new BoundingBox(new Vector3(myRandom.Next(-100, -1), myRandom.Next(-100, -1), myRandom.Next(-100, -1)), new Vector3(myRandom.Next(0, 100), myRandom.Next(0, 100), myRandom.Next(0, 100)))); myATree.Insert(myEntity); } Assert.AreEqual(myBTree.CompareTo(myBTree), 0); }
public void SimpleAABBTree_CompareToCheck_DifferentSizedTrees_SameItems() { SimpleAABBTree myATree = new SimpleAABBTree(); SimpleAABBTree myBTree = new SimpleAABBTree(); BoundingBox myBox; int TESTCOUNT = 20; object myObjectToRemove = null; for (int i = 0; i < TESTCOUNT; i++) { var myEntity = new SimpleAABBTreeDynamicInstance(new BoundingBox(new Vector3(myRandom.Next(-100, -1), myRandom.Next(-100, -1), myRandom.Next(-100, -1)), new Vector3(myRandom.Next(0, 100), myRandom.Next(0, 100), myRandom.Next(0, 100)))); if (i + 1 != TESTCOUNT) { myATree.Insert(myEntity); } myBTree.Insert(myEntity); } Assert.AreEqual(1, myATree.CompareTo(myBTree)); Assert.AreEqual(-1, myBTree.CompareTo(myATree)); }