Esempio n. 1
0
        public void ComputeFormula_SimpleExponentFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("8^(2)");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("64", lResult);
        }
Esempio n. 2
0
        public void ComputeFormula_MultiplicationFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("7×5");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("35", lResult);
        }
Esempio n. 3
0
        public void ComputeFormula_NegativeFloatDivisionFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("8.56÷(-37.2110)");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("(-0,23003950444761)", lResult.ToString());
        }
Esempio n. 4
0
        public void ComputeFormula_DivisionByZeroFormula_ReturnsException()
        {
            PEMDAS lPemdas = new PEMDAS("8÷0");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("∞", lResult);
        }
Esempio n. 5
0
        public void ComputeFormula_SimpleRootSquareFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("√(64)");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("8", lResult);
        }
Esempio n. 6
0
        public void ComputeFormula_SimpleFloatSubstraction_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("7.51-5.6333333");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("1,8766667", lResult);
        }
Esempio n. 7
0
        public void ComputeFormula_SubtractNegative_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("7.51-(-5.6333333)");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("13,1433333", lResult);
        }
Esempio n. 8
0
        public void ComputeFormula_SimpleAdditionFormula2_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("5+0.7");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("5,7", lResult);
        }
Esempio n. 9
0
        public void ComputeFormula_SimpleFloatAdditionFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("5.591112+7.158165555");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("12,749277555", lResult);
        }
Esempio n. 10
0
        public void ComputeFormula_SimpleAdditionFormulaWithComa_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("5.5+7.15");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("12,65", lResult);
        }
Esempio n. 11
0
        public void ComputeFormula_SimpleSubstractionFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("7-5");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("2", lResult);
        }
Esempio n. 12
0
        public void ComputeFormula_SimpleDivisionFormula_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("8÷2");
            var    lResult = lPemdas.ComputeFormula();

            Assert.AreEqual("4", lResult);
        }
Esempio n. 13
0
        public void DoCompute_WithRootSquare3_ReturnsException()
        {
            PEMDAS lPemdas = new PEMDAS("√((-1))");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("NaN", lResult);
        }
Esempio n. 14
0
        public void DoCompute_WithRootSquare2_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("√(15)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("3,87298334620742", lResult);
        }
Esempio n. 15
0
        public void DoCompute_WithRootSquare_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("√(81)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("9", lResult);
        }
Esempio n. 16
0
        public void DoCompute_ExponentWithNegativeNumberAfterOperator_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("5^((-2))");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("0,04", lResult.ToString());
        }
Esempio n. 17
0
        public void DoCompute_ExponentWithNegativeNumberBeforeOperator_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("(-5)^(2)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("25", lResult.ToString());
        }
Esempio n. 18
0
        public void DoCompute_WithMultiplication2_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15.67×16.20");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("253,854", lResult.ToString());
        }
Esempio n. 19
0
        public void DoCompute_MultiplicationWithNegativeNumberAfterOperator_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("(-15)×(-16)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("240", lResult.ToString());
        }
Esempio n. 20
0
        public void DoCompute_WithDivision4_ReturnsException()
        {
            PEMDAS lPemdas = new PEMDAS("1÷0.99999999999999999999999999999999999999999999999999999999999999999999999999999");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("1", lResult);
        }
Esempio n. 21
0
        public void DoCompute_DivisionByZero_ReturnsInfinityNumber()
        {
            PEMDAS lPemdas = new PEMDAS("15.67÷0");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("∞", lResult.ToString());
        }
Esempio n. 22
0
        public void DoCompute_WithDivision2_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15.67÷16.20");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("0,967283950617284", lResult.ToString());
        }
Esempio n. 23
0
        public void DoCompute_WithDivision_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15÷16");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("0,9375", lResult.ToString());
        }
Esempio n. 24
0
        public void DoReplaceByResult_SimplyOperation_ReturnsNewFormulaWithResult()
        {
            PEMDAS lPemdas = new PEMDAS("5×7");

            lPemdas.DoReplaceByResult("35");

            Assert.AreEqual("35", lPemdas.Chunk.SB.ToString());
        }
Esempio n. 25
0
        public void DoCompute_WithExponent_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15^(2)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("225", lResult.ToString());
        }
Esempio n. 26
0
        public void DoCompute_WithMultiplication3_ReturnsException()
        {
            PEMDAS lPemdas = new PEMDAS("156700000000000000000000000000000000000000000000000000000000000000×1600000000000000000000000000000000000000000000000000000000000000020");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("2,5072E+131", lResult);
        }
Esempio n. 27
0
        public void DoCompute_WithExponent2_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15^(16)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("6,56840835571289E+18", lResult.ToString());
        }
Esempio n. 28
0
        public void DoCompute_ExponentWithHugeNumber_ReturnsInfinityNumber()
        {
            PEMDAS lPemdas = new PEMDAS("150^(1000)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("∞", lResult.ToString());
        }
Esempio n. 29
0
        public void DoCompute_DivisionWithNegativeNumberAfterOperator_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("15÷(-16)");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("(-0,9375)", lResult);
        }
Esempio n. 30
0
        public void DoCompute_SubstactionWithNegativeNumberBeforeOperator_ReturnsResult()
        {
            PEMDAS lPemdas = new PEMDAS("(-15)-16");

            lPemdas.DoCompute(out string lResult);

            Assert.AreEqual("(-31)", lResult.ToString());
        }