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, " ") }); }
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) ) }); }
void ParseTest(string statement, int position, ArithmeticToken expectedToken) { var token = ArithmeticToken.GetNextToken(statement, position); Assert.Equal(expectedToken, token); }