Created
October 26, 2016 02:52
-
-
Save toptensoftware/151e0cefc6641232a5f578cecf281691 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Negative | |
| Assert.AreEqual(Parser.Parse("-10").Eval(), -10); | |
| // Positive | |
| Assert.AreEqual(Parser.Parse("+10").Eval(), 10); | |
| // Negative of a negative | |
| Assert.AreEqual(Parser.Parse("--10").Eval(), 10); | |
| // Woah! | |
| Assert.AreEqual(Parser.Parse("--++-+-10").Eval(), 10); | |
| // All together now | |
| Assert.AreEqual(Parser.Parse("10 + -20 - +30").Eval(), -40); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment