Пример #1
0
        public void GetPolishEntryListElements_TestNotCorrectValue()
        {
            //arrange
            ParserMathStr.ParserMathStrInPolishEntry parserMathStr =
                new ParserMathStr.ParserMathStrInPolishEntry();
            string        str      = "йцук-123(йцу)йцу+";
            List <string> expected = new List <string>()
            {
            };
            // Act
            List <string> actual =
                parserMathStr.GetExpressionPolishEntry(str);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Пример #2
0
        public void GetPolishEntryListElements_TestBarr()
        {
            //arrange
            ParserMathStr.ParserMathStrInPolishEntry parserMathStr =
                new ParserMathStr.ParserMathStrInPolishEntry();
            string        str      = "(((10-10)20*10)(40(10-25)))";
            List <string> expected = new List <string>()
            {
                "10", "10", "-", "20", "10", "*", "40", "10", "25", "-"
            };
            // Act
            List <string> actual =
                parserMathStr.GetExpressionPolishEntry(str);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Пример #3
0
        public void GetPolishEntryListElements_TestNewElement()
        {
            //arrange
            ParserMathStr.ParserMathStrInPolishEntry parserMathStr =
                new ParserMathStr.ParserMathStrInPolishEntry();
            string        str      = "sin(1)^cos(0)";
            List <string> expected = new List <string>()
            {
                "1", "sin", "0", "cos", "^"
            };
            // Act
            List <string> actual =
                parserMathStr.GetExpressionPolishEntry(str);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Пример #4
0
        public void GetPolishEntryListElements_TestEasyExpression()
        {
            //arrange
            string str = "1 / 2";

            ParserMathStr.ParserMathStrInPolishEntry parserMathStr =
                new ParserMathStr.ParserMathStrInPolishEntry();
            List <string> expected = new List <string>()
            {
                "1", "2", "/"
            };
            // Act
            List <string> actual =
                parserMathStr.GetExpressionPolishEntry(str);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Пример #5
0
        public void GetPolishEntryListElements_TestEasyPlusExpression()
        {
            //arrange
            string str = "7 + (5 - 2) * 4";

            ParserMathStr.ParserMathStrInPolishEntry parserMathStr =
                new ParserMathStr.ParserMathStrInPolishEntry();

            List <string> expected = new List <string>()
            {
                "7", "5", "2", "-", "4", "*", "+"
            };
            // Act
            List <string> actual =
                parserMathStr.GetExpressionPolishEntry(str);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }