Пример #1
0
        public void TestWalking()
        {
            TCODBSP bspSized = new TCODBSP(0, 0, 10, 10);
            bspSized.SplitOnce(false, 5);
            bspSized.GetLeft().SplitOnce(true, 5);
            bspSized.GetRight().SplitOnce(true, 5);

            passes = 0;
            bspSized.TraversePreOrder(new TCODBSPTraversalDelegate(this.TCODBSPTraversal));
            Assert.AreEqual(7, passes);

            passes = 0;
            bspSized.TraverseInOrder(new TCODBSPTraversalDelegate(this.TCODBSPTraversal));
            Assert.AreEqual(7, passes);

            passes = 0;
            bspSized.TraverseInvertedOrder(new TCODBSPTraversalDelegate(this.TCODBSPTraversal));
            Assert.AreEqual(7, passes);

            passes = 0;
            bspSized.TraverseLevelOrder(new TCODBSPTraversalDelegate(this.TCODBSPTraversal));
            Assert.AreEqual(7, passes);

            passes = 0;
            bspSized.TraversePostOrder(new TCODBSPTraversalDelegate(this.TCODBSPTraversal));
            Assert.AreEqual(7, passes);
        }