💕 Adding assignment 2

This commit is contained in:
2024-09-12 13:54:13 +02:00
parent 3722040d09
commit b061522fd1
9 changed files with 321 additions and 0 deletions

View File

@ -0,0 +1,26 @@
module APL.Check_Tests (tests) where
import APL.AST (Exp (..))
import APL.Check (checkExp)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (assertFailure, testCase, (@?=))
-- Assert that the provided expression should pass the type checker.
testPos :: Exp -> TestTree
testPos e =
testCase (show e) $
checkExp e @?= Nothing
-- Assert that the provided expression should fail the type checker.
testNeg :: Exp -> TestTree
testNeg e =
testCase (show e) $
case checkExp e of
Nothing -> assertFailure "expected error"
Just _ -> pure ()
tests :: TestTree
tests =
testGroup
"Checking"
[]