From e64cb84fe43660818f7d6eff2954147495b1ac8b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 7 Jan 2015 09:53:14 -0700 Subject: Fixed parsing bug, added unit tests, debug cleanup. There was an issue with order of operations outside of parenthesies, easily solved. --- src/unitparser.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/unitparser.cpp') diff --git a/src/unitparser.cpp b/src/unitparser.cpp index e23f76c..f518fdc 100644 --- a/src/unitparser.cpp +++ b/src/unitparser.cpp @@ -38,6 +38,8 @@ void UnitParser::order1() unitTest(parse("1.59*40/24*21", 5) == "55.65"); unitTest(parse("1.59*40/(24*21)", 5) == "0.12619"); // bc says it's this: "0.12619"); unitTest(parse("10+2*2*2+2") == "20"); + unitTest(parse("5-5-1") == "-1"); + unitTest(parse("5-(1+2+2)-1") == "-1"); } void UnitParser::assignment() -- cgit v1.2.3