public void ShouldDisplayTheCorrectPostfixNotation(string input, string expectedOutput) { // ARRANGE input = Helper.RemoveWhiteSpace(input: input); IShuntingYard sy = new ShuntingYard(input: input); sy.ConvertToPostfix(); // ACT string output = Helper.ConvertToString(input: sy.GetPostfix()); // ASSERT Assert.Equal(expectedOutput, output); }
public void ShouldEvaluateTheExpressionCorrectly(string input, double expectedOutput) { // ARRANGE input = Helper.RemoveWhiteSpace(input: input); IShuntingYard sy = new ShuntingYard(input: input); sy.ConvertToPostfix(); // ACT double output = sy.Evaluate(); // ASSERT Assert.Equal(expectedOutput, output); }
public PostfixNotation CompileToPostfix(string expression) { var rawNotation = grammarCompiler.Compile(expression); return(shuntingYard.ConvertToPostfix(rawNotation)); }