Пример #1
0
        public void TestingTreeExpressionSubract()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("6-5");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 1.0);
        }
Пример #2
0
        public void TestingTreeExpressionMult()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("6*5");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 30.0);
        }
Пример #3
0
        public void TestingTreeExpressionAdd()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("6+5+7");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 18.0);
        }
Пример #4
0
        public void TestingEvaluateParentheses()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("(5*(2+2))");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 20.0);
        }
Пример #5
0
        public void TestingInitailVariable()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("A1");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 0.0);
        }
Пример #6
0
        public void TestingTreeExpressionDivide()
        {
            ExpressionTree expressionTreeTest = new ExpressionTree("10/5");

            Assert.AreEqual(expressionTreeTest.Evaluate(), 2.0);
        }