1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/test/Asm/Run/Negative.hs

46 lines
950 B
Haskell
Raw Normal View History

2022-09-29 18:44:55 +03:00
module Asm.Run.Negative where
import Asm.Run.Base
import Base
data NegTest = NegTest
{ _name :: String,
2022-12-20 15:05:40 +03:00
_relDir :: Path Rel Dir,
_file :: Path Rel File
2022-09-29 18:44:55 +03:00
}
2022-12-20 15:05:40 +03:00
root :: Path Abs Dir
root = relToProject $(mkRelDir "tests/Asm/negative")
2022-09-29 18:44:55 +03:00
testDescr :: NegTest -> TestDescr
testDescr NegTest {..} =
2022-12-20 15:05:40 +03:00
let tRoot = root <//> _relDir
file' = tRoot <//> _file
2022-09-29 18:44:55 +03:00
in TestDescr
{ _testName = _name,
_testRoot = tRoot,
2022-12-20 15:05:40 +03:00
_testAssertion = Steps $ asmRunErrorAssertion file'
2022-09-29 18:44:55 +03:00
}
allTests :: TestTree
allTests =
testGroup
"JuvixAsm run negative tests"
(map (mkTest . testDescr) tests)
tests :: [NegTest]
tests =
[ NegTest
"Division by zero"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test001.jva"),
2022-09-29 18:44:55 +03:00
NegTest
"Invalid memory access"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test002.jva"),
2022-09-29 18:44:55 +03:00
NegTest
"No matching case branch"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test003.jva")
2022-09-29 18:44:55 +03:00
]