コード例 #1
0
        public void IsValidBSTTest_MinInt()
        {
            var solution = new _098_ValidateBinarySearchTree();

            Assert.IsTrue(solution.IsValidBST(TestHelper.GenerateTree(new int?[] { int.MinValue })));
            Assert.IsFalse(solution.IsValidBST(TestHelper.GenerateTree(new int?[] { int.MinValue, int.MinValue })));
        }
コード例 #2
0
        public void IsValidBSTTest()
        {
            var solution = new _098_ValidateBinarySearchTree();

            Assert.IsTrue(solution.IsValidBST(TestHelper.GenerateTree(new int?[] { 2, 1, 3 })));
        }
コード例 #3
0
        public void IsValidBSTTest_Empty()
        {
            var solution = new _098_ValidateBinarySearchTree();

            Assert.IsTrue(solution.IsValidBST(null));
        }
コード例 #4
0
        public void IsValidBSTTest_Invalid_2Layer()
        {
            var solution = new _098_ValidateBinarySearchTree();

            Assert.IsFalse(solution.IsValidBST(TestHelper.GenerateTree(new int?[] { 5, 1, 6, null, null, 3, 8 })));
        }