예제 #1
0
//        [Repeat(25)]
        public void TestBstSearchAlgorithm()
        {
            int[] values = TreeTests.GenerateArrayWithRandomIntegers();

            // Build tree
            var tree = new BinaryTree(values);

            // Check if it can find the first index
            Assert.IsTrue(tree.Search(values[1]));
        }
예제 #2
0
//        [Repeat(25)]
        public void TestBstInsertAlgorithm()
        {
            int[] values = TreeTests.GenerateArrayWithRandomIntegers();

            // Build tree
            var tree = new BinaryTree(values);

            // Validate entire tree structure
            Assert.IsTrue(ValidateBst(tree.Root));
        }
예제 #3
0
//        [Repeat(25)]
        public void TestKdtInsertAlgorithm()
        {
            int[] x = TreeTests.GenerateArrayWithRandomIntegers();
            int[] y = TreeTests.GenerateArrayWithRandomIntegers();

            var values = new Vector2[x.Length];

            for (int i = 0; i < x.Length; i++)
            {
                values[i] = new Vector2(x[i], y[i]);
            }

            // Build tree
            var tree = new KdTree(values);

            // Validate entire tree structure
            // TODO: Write unit test to validate the KdTree
            Assert.IsTrue(ValidateKdt(tree.Root));
            Console.Write("");
        }