From 48fee71319b45f70d2cc807c744dc9fe79fabcfe Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Thu, 5 Jan 2023 15:37:25 +0100 Subject: Day11, MonkeyBrain, kinda finished. --- Day11/tests/MonkeyBrain-Tests.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Day11/tests/MonkeyBrain-Tests.hs (limited to 'Day11/tests/MonkeyBrain-Tests.hs') 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 -- cgit v1.2.3