summaryrefslogtreecommitdiff
path: root/Day11/tests/MonkeyBrain-Tests.hs
blob: 9049aeb1bd5385791e93c0fb006d5a13d01d8a16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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]