Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Add compute tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TTENSHII committed Dec 8, 2023
1 parent e0aac41 commit 45b9331
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ main :: IO ()
main = defaultMainWithIngredients (htmlRunner : defaultIngredients) tests

tests :: TestTree
tests = testGroup "Tests" [unitTests]
tests = testGroup "Tests" [unitTests, computeTests]

unitTests :: TestTree
unitTests = testGroup "Unit tests"
Expand All @@ -19,3 +19,13 @@ unitTests = testGroup "Unit tests"
, testCase "Basic AST creation 2" $
assertEqual "42" (Leaf (Number 42)) (Leaf (Number 42))
]

computeTests :: TestTree
computeTests = testGroup "Compute tests"
[ testCase "Basic compute 0" $
assertEqual "define x 42" (Atom 42) (computeAst (Node "define" [Leaf (Symbol "x"), Leaf (Number 42)]))
, testCase "Basic compute 1" $
assertEqual "define x 42 and do x + x" (Leaf (Number 42)) (compute (Node "define" [Leaf (Symbol "x"), Leaf (Number 42)]))
, testCase "Basic compute 2" $
assertEqual "42 + 42" (Atom 84) (computeAst (Node "+" [Leaf (Number 42), Leaf (Number 42)]))
]

0 comments on commit 45b9331

Please sign in to comment.