🤡 onlyCheckedErrors

This commit is contained in:
2024-10-11 15:46:28 +02:00
parent 533f16ba81
commit 8ab279d488

View File

@ -5,6 +5,7 @@ module APL.Tests
where where
import APL.AST (Exp (..), subExp, VName, printExp) import APL.AST (Exp (..), subExp, VName, printExp)
import APL.Eval (eval, runEval)
import APL.Parser (parseAPL, keywords) import APL.Parser (parseAPL, keywords)
import APL.Error (isVariableError, isDomainError, isTypeError) import APL.Error (isVariableError, isDomainError, isTypeError)
import APL.Check (checkExp) import APL.Check (checkExp)
@ -114,11 +115,13 @@ parsePrinted e = case (parseAPL "input" (printExp e)) of
Right e' -> e == e' Right e' -> e == e'
onlyCheckedErrors :: Exp -> Bool onlyCheckedErrors :: Exp -> Bool
onlyCheckedErrors _ = undefined onlyCheckedErrors e = case runEval (eval e) of
Right _ -> True
Left err -> err `elem` (checkExp e)
properties :: [(String, Property)] properties :: [(String, Property)]
properties = properties =
[ ("expCoverage", property expCoverage) [ ("expCoverage", property expCoverage)
, ("parsePrinted", property (withMaxSuccess 10000 parsePrinted)) , ("parsePrinted", property (withMaxSuccess 10000 parsePrinted))
, ("onlyCheckedErrors", property onlyCheckedErrors) , ("onlyCheckedErrors", property (withMaxSuccess 1000000 onlyCheckedErrors))
] ]