コード例 #1
0
        public void testInnerElementMethod1()
        {
            ///1st passing test
            string input = "(1+2)";

            //should return 1+2
            SOtests.Solution methodTOtest = new SOtests.Solution();
            var output = methodTOtest.InnerElement(input);

            Assert.IsTrue(output == "1+2");
        }
コード例 #2
0
        public void TestCalculator2()
        {
            ///1st passing test
            string input = "(2+8)/2+1*3";

            //should return 1+2
            SOtests.Solution methodTOtest = new SOtests.Solution();
            var output = methodTOtest.CalculatorParser(input);

            Assert.IsTrue(output == "8");
        }
コード例 #3
0
        public void TestWhileEvaluation1()
        {
            ///1st passing test
            string input = "345";

            //should return 1+2
            SOtests.Solution methodTOtest = new SOtests.Solution();
            var output = methodTOtest.WhileEvaluation(input);

            Assert.IsTrue(!output);
        }
コード例 #4
0
        public void TestCreateUnitElement3()
        {
            ///1st passing test
            string input = "2+18/2+1*3";

            //should return 1+2
            SOtests.Solution methodTOtest = new SOtests.Solution();
            var output = methodTOtest.CreateUnitElement(input);

            Assert.IsTrue(output == "14");
        }
コード例 #5
0
        public void TestCalculator6()
        {
            ///1st passing test
            string input = "(6)-(8)-(7)+(1+(6))";

            //should return 1+2
            SOtests.Solution methodTOtest = new SOtests.Solution();
            var output = methodTOtest.CalculatorParser(input);

            Assert.IsTrue(output == "-2");
        }