Exemplo n.º 1
0
        public static void IsSuperbalanced_HandlesDeepInbalance2Correctly()
        {
            var root = BinaryTreeStringUtil.Create("[1] [2 3] [4 * * 7] [8 * * * * * * *] [16]");

            Assert.That(SuperbalancedBinaryTree.IsSuperbalanced(root), Is.EqualTo(false));
        }
Exemplo n.º 2
0
        public static void IsSuperbalanced_HandlesSingleBranchCorrectly()
        {
            var root = BinaryTreeStringUtil.Create("[1] [2 *] [4 * * *]");

            Assert.That(SuperbalancedBinaryTree.IsSuperbalanced(root), Is.EqualTo(true));
        }
Exemplo n.º 3
0
 public static void IsSuperbalanced_HandlesNullCorrectly()
 {
     Assert.Throws <ArgumentNullException>(() => SuperbalancedBinaryTree.IsSuperbalanced(null));
 }
Exemplo n.º 4
0
        public static void IsSuperbalanced_HandlesNoChildrenCorrectly()
        {
            var root = BinaryTreeStringUtil.Create("[1]");

            Assert.That(SuperbalancedBinaryTree.IsSuperbalanced(root), Is.EqualTo(true));
        }
Exemplo n.º 5
0
        public static void IsSuperbalanced_BasicExample_ReturnsExpected()
        {
            var root = BinaryTreeStringUtil.Create("[1] [2 3] [4 5 6 7]");

            Assert.That(SuperbalancedBinaryTree.IsSuperbalanced(root), Is.EqualTo(true));
        }