summaryrefslogtreecommitdiff
path: root/Day11/tests/MonkeyBrain-Tests.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Day11/tests/MonkeyBrain-Tests.hs')
-rw-r--r--Day11/tests/MonkeyBrain-Tests.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Day11/tests/MonkeyBrain-Tests.hs b/Day11/tests/MonkeyBrain-Tests.hs
new file mode 100644
index 0000000..9049aeb
--- /dev/null
+++ b/Day11/tests/MonkeyBrain-Tests.hs
@@ -0,0 +1,15 @@
+module Main where
+import Test.Framework
+import Test.Framework.Providers.HUnit
+import Test.HUnit
+
+import MonkeyBrain
+
+main = defaultMain tests
+
+test1 = TestCase $ assertEqual "(2+7*3+2-1-3+17/4*2)*(3+4*-1+20)/(17-3*4)"
+ (Right (Just (((2+7*3+2-1-3+17 `quot` 4*2)*(3+4*(-1)+20) `quot` (17-3*4)) :: Int)))
+ $ fmap (\x -> evaluateIntExpression x (VariableValues [])) (tryParseExpression (VariableNameValidator (const True)) "(2+7*3+2-1-3+17/4*2)*(3+4*-1+20)/(17-3*4)")
+
+-- hUnitTestToTests: Adapt an existing HUnit test into a list of test-framework tests
+tests = hUnitTestToTests $ TestList [TestLabel "Test1" test1] \ No newline at end of file