public void NegationRewriter_Can_Rewrite_Subtraction_Token_If_Preceeded_By_Opening_Parenthesis()
{
// 3+(-2)
List<Token> tokens = new List<Token> {
new Token(TokenType.Numeric, 3),
new Token(TokenType.Addition, "+"),
new Token(TokenType.OpeningParenthesis, "("),
new Token(TokenType.Subtraction, "-"),
new Token(TokenType.Numeric, "3"),
new Token(TokenType.ClosingParenthesis, ")")
};
TokenStream stream = new TokenStream(tokens, TokenNotation.Infix);
TokenPipeline pipeline = new TokenPipeline(new NegationRewriter());
var result = pipeline.Process(stream);
Assert.AreEqual(6, result.Count);
Assert.AreEqual(TokenType.Negation, result[3].Type);
}