diff options
author | Mike Buland <mike@xagasoft.com> | 2015-01-07 09:53:14 -0700 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2015-01-07 09:53:14 -0700 |
commit | e64cb84fe43660818f7d6eff2954147495b1ac8b (patch) | |
tree | 8e89978bc4a72677a8728d62eb850d81c9b92d46 /src/unitparser.cpp | |
parent | 4d0ab515cc4142b22247e26f1b57b5cd0a6b31d5 (diff) | |
download | clic-e64cb84fe43660818f7d6eff2954147495b1ac8b.tar.gz clic-e64cb84fe43660818f7d6eff2954147495b1ac8b.tar.bz2 clic-e64cb84fe43660818f7d6eff2954147495b1ac8b.tar.xz clic-e64cb84fe43660818f7d6eff2954147495b1ac8b.zip |
Fixed parsing bug, added unit tests, debug cleanup.0.12
There was an issue with order of operations outside of parenthesies,
easily solved.
Diffstat (limited to 'src/unitparser.cpp')
-rw-r--r-- | src/unitparser.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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() | |||
38 | unitTest(parse("1.59*40/24*21", 5) == "55.65"); | 38 | unitTest(parse("1.59*40/24*21", 5) == "55.65"); |
39 | unitTest(parse("1.59*40/(24*21)", 5) == "0.12619"); // bc says it's this: "0.12619"); | 39 | unitTest(parse("1.59*40/(24*21)", 5) == "0.12619"); // bc says it's this: "0.12619"); |
40 | unitTest(parse("10+2*2*2+2") == "20"); | 40 | unitTest(parse("10+2*2*2+2") == "20"); |
41 | unitTest(parse("5-5-1") == "-1"); | ||
42 | unitTest(parse("5-(1+2+2)-1") == "-1"); | ||
41 | } | 43 | } |
42 | 44 | ||
43 | void UnitParser::assignment() | 45 | void UnitParser::assignment() |