Exemple #1
0
        public void ComputeParenthesis_PutFormulaWithParenthesis_ReturnsChunkWithTheSmallerParenthesis()
        {
            // Arrange
            string lFormula = "2^(5÷3)+4×((5÷2))";

            // Act
            PEMDAS lPEMDAS = new PEMDAS(lFormula);

            lPEMDAS.Chunk = new Chunk(new StringBuilder(lFormula), 0, lFormula.Length);
            lPEMDAS.ExtractParenthesis();

            // Assert
            Assert.AreEqual("(5÷3)", lPEMDAS.Chunk.SB.ToString());
            Assert.AreEqual(2, lPEMDAS.Chunk.StartIndex);
            Assert.AreEqual(5, lPEMDAS.Chunk.Length);
        }