コード例 #1
0
        public void GenerateParenthesisTest_NEqualZero()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(0);

            Assert.AreEqual(0, result.Count);
        }
コード例 #2
0
        public void GenerateParenthesisTest_NLessThanZero()
        {
            var solution = new _022_GenerateParentheses();
            var result = solution.GenerateParenthesis(-1);

            Assert.AreEqual(0, result.Count);
        }
コード例 #3
0
        public void GenerateParenthesisTest_NEqualOne()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(1);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("()", result[0]);
        }
コード例 #4
0
        public void GenerateParenthesisTest_NEqualOne()
        {
            var solution = new _022_GenerateParentheses();
            var result = solution.GenerateParenthesis(1);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("()", result[0]);
        }
コード例 #5
0
 public void GenerateParenthesisTest_LargeN()
 {
     var solution = new _022_GenerateParentheses();
     var result = solution.GenerateParenthesis(4);
     Assert.AreEqual(14, result.Count);
     result = solution.GenerateParenthesis(5);
     Assert.AreEqual(42, result.Count);
     result = solution.GenerateParenthesis(6);
     Assert.AreEqual(132, result.Count);
 }
コード例 #6
0
        public void GenerateParenthesisTest_LargeN()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(4);

            Assert.AreEqual(14, result.Count);
            result = solution.GenerateParenthesis(5);
            Assert.AreEqual(42, result.Count);
            result = solution.GenerateParenthesis(6);
            Assert.AreEqual(132, result.Count);
        }
コード例 #7
0
        public void GenerateParenthesisTest()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(3);

            Assert.AreEqual(5, result.Count);
            Assert.AreEqual("((()))", result[0]);
            Assert.AreEqual("(()())", result[1]);
            Assert.AreEqual("(())()", result[2]);
            Assert.AreEqual("()(())", result[3]);
            Assert.AreEqual("()()()", result[4]);
        }
コード例 #8
0
        public void GenerateParenthesisTest()
        {
            var solution = new _022_GenerateParentheses();
            var result = solution.GenerateParenthesis(3);

            Assert.AreEqual(5, result.Count);
            Assert.AreEqual("((()))", result[0]);
            Assert.AreEqual("(()())", result[1]);
            Assert.AreEqual("(())()", result[2]);
            Assert.AreEqual("()(())", result[3]);
            Assert.AreEqual("()()()", result[4]);
        }