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);
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void GenerateParenthesisTest_NEqualZero()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(0);

            Assert.AreEqual(0, result.Count);
        }
        public void GenerateParenthesisTest_NLessThanZero()
        {
            var solution = new _022_GenerateParentheses();
            var result = solution.GenerateParenthesis(-1);

            Assert.AreEqual(0, result.Count);
        }
Exemplo n.º 5
0
        public void GenerateParenthesisTest_NEqualOne()
        {
            var solution = new _022_GenerateParentheses();
            var result   = solution.GenerateParenthesis(1);

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

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("()", result[0]);
        }
Exemplo n.º 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]);
        }
        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]);
        }