Esempio n. 1
0
        public void ComputeMultiplicationOrDivision_WithMultiplyFirstAndDivision2_ReturnsMultiplicationChunk()
        {
            // Arrange
            PEMDAS lPemdas = new PEMDAS("6+2-8×5+3÷2+(5^(10))");

            // Act
            lPemdas.ComputeMultAndDiv();

            // Assert
            Assert.AreEqual("8×5", lPemdas.Chunk.SB.ToString());
        }
Esempio n. 2
0
        public void ComputeMultiplicationOrDivision_WithDivideFirstAndMultiplication_ReturnsDivisionChunk()
        {
            // Arrange
            PEMDAS lPemdas = new PEMDAS("8÷5+3×2+(5^(10))");

            // Act
            lPemdas.ComputeMultAndDiv();

            // Assert
            Assert.AreEqual("8÷5", lPemdas.Chunk.SB.ToString());
        }
Esempio n. 3
0
        public void ComputeMultiplicationOrDivision_WithDivisionFirstAndMultiplicationAndParenthesis_ReturnsDivisionChunk()
        {
            // Arrange
            PEMDAS lPemdas = new PEMDAS("6+2-(3÷2×5)+(5^(10))");

            // Act
            lPemdas.ComputeMultAndDiv();

            // Assert
            Assert.AreEqual("3÷2", lPemdas.Chunk.SB.ToString());
        }
Esempio n. 4
0
        public void ComputeMultiplicationOrDivision_MultiplicationWithSigned_ReturnsMultiplicationChunk()
        {
            // Arrange
            PEMDAS lPemdas = new PEMDAS("6+2-((-3)×2÷5)+(5^(10))");

            // Act
            lPemdas.ComputeMultAndDiv();

            // Assert
            Assert.AreEqual("(-3)×2", lPemdas.Chunk.SB.ToString());
        }
Esempio n. 5
0
        public void ComputeMultiplicationOrDivision_PutMultiplicationInParenthesis_ReturnsStartIndexAndLengthMultiplicationChunk()
        {
            // Arrange
            PEMDAS lPemdas = new PEMDAS("6+2-(3×2÷5)+(5^(10))");

            // Act
            lPemdas.ComputeMultAndDiv();

            // Assert
            Assert.AreEqual(5, lPemdas.Chunk.StartIndex);
            Assert.AreEqual(3, lPemdas.Chunk.Length);
        }