Example #1
0
        public void Test1()
        {
            string       input = "3+4*2";
            IComplexMath test  = new ComplexMath();

            Assert.AreEqual(test.EvaluateExpression(input), 11);
        }
Example #2
0
        public void TestExpression2()
        {
            // Arrange
            string       input = "1+3-2+2";
            IComplexMath cm    = new ComplexMath();
            float        ans   = 1 + 3 - 2 + 2;
            // Act
            float res = cm.EvaluateExpression(input);

            // Assert
            Assert.AreEqual(res, ans);
        }
Example #3
0
        public void TestExpression()
        {
            // Arrange
            string       input = "3+ 4*2 - 3/2 * 5";
            IComplexMath cm    = new ComplexMath();
            float        ans   = 3 + 4 * 2 - (float)3 / 2 * 5;
            // Act
            float res = cm.EvaluateExpression(input);

            // Assert
            Assert.AreEqual(res, ans);
        }