Last active
October 26, 2016 03:23
-
-
Save toptensoftware/ddcba28e4ba45145b11b54c6329c6d2d 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
| // No parens | |
| Assert.AreEqual(Parser.Parse("10 + 20 * 30").Eval(), 610); | |
| // Parens | |
| Assert.AreEqual(Parser.Parse("(10 + 20) * 30").Eval(), 900); | |
| // Parens and negative | |
| Assert.AreEqual(Parser.Parse("-(10 + 20) * 30").Eval(), -900); | |
| // Nested | |
| Assert.AreEqual(Parser.Parse("-((10 + 20) * 5) * 30").Eval(), -4500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment