Пример #1
0
        public static IEnumerable <object> GetParseTestData()
        {
            yield return(new object[] { "1+3", 0, ArithmeticToken.Create(ArithmeticTokenKind.Integer, "1") });

            yield return(new object[] { string.Empty, 0, ArithmeticToken.Create(ArithmeticTokenKind.End, string.Empty) });

            yield return(new object[] { " ", 0, ArithmeticToken.Create(ArithmeticTokenKind.Nope, " ") });
        }
Пример #2
0
 public static IEnumerable <object> GetFromPostfixNotationTestData()
 {
     yield return(new object[] {
         new [] {
             ArithmeticToken.Create(ArithmeticTokenKind.Integer, "1"),
             ArithmeticToken.Create(ArithmeticTokenKind.Integer, "2"),
             ArithmeticToken.Create(ArithmeticTokenKind.Operator, "+")
         },
         Expression.Add(
             Expression.Constant(1),
             Expression.Constant(2)
             )
     });
 }
Пример #3
0
        void ParseTest(string statement, int position, ArithmeticToken expectedToken)
        {
            var token = ArithmeticToken.GetNextToken(statement, position);

            Assert.Equal(expectedToken, token);
        }