1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-18 12:21:46 +03:00
juvix/test/Runtime/Positive.hs

138 lines
3.6 KiB
Haskell
Raw Normal View History

2022-11-03 11:38:09 +03:00
module Runtime.Positive where
import Base
import Runtime.Base
data PosTest = PosTest
{ _name :: String,
2022-12-20 15:05:40 +03:00
_relDir :: Path Rel Dir,
_file :: Path Rel File,
_expectedFile :: Path Rel File
2022-11-03 11:38:09 +03:00
}
makeLenses ''PosTest
2022-12-20 15:05:40 +03:00
root :: Path Abs Dir
root = relToProject $(mkRelDir "tests/runtime/positive/")
2022-11-03 11:38:09 +03:00
testDescr :: PosTest -> TestDescr
testDescr PosTest {..} =
2022-12-20 15:05:40 +03:00
let tRoot = root <//> _relDir
file' = tRoot <//> _file
expected' = tRoot <//> _expectedFile
2022-11-03 11:38:09 +03:00
in TestDescr
{ _testName = _name,
_testRoot = tRoot,
2022-12-20 15:05:40 +03:00
_testAssertion = Steps $ clangAssertion file' expected' ""
2022-11-03 11:38:09 +03:00
}
allTests :: TestTree
allTests =
testGroup
"Runtime positive tests"
(map (mkTest . testDescr) tests)
tests :: [PosTest]
tests =
[ PosTest
"Test001: HelloWorld"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test001.c")
$(mkRelFile "out/test001.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test002: Page allocation"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test002.c")
$(mkRelFile "out/test002.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test003: Printing of integers"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test003.c")
$(mkRelFile "out/test003.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test004: Allocator for unstructured objects"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test004.c")
$(mkRelFile "out/test004.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test005: Allocator for unstructured objects (macro API)"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test005.c")
$(mkRelFile "out/test005.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test006: Stack"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test006.c")
$(mkRelFile "out/test006.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test007: Prologue and epilogue"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test007.c")
$(mkRelFile "out/test007.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test008: Basic arithmetic"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test008.c")
$(mkRelFile "out/test008.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test009: Direct call"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test009.c")
$(mkRelFile "out/test009.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test010: Indirect call"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test010.c")
$(mkRelFile "out/test010.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test011: Tail calls"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test011.c")
$(mkRelFile "out/test011.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test012: Tracing and strings"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test012.c")
$(mkRelFile "out/test012.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test013: IO builtins"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test013.c")
$(mkRelFile "out/test013.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test014: Higher-order functions"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test014.c")
$(mkRelFile "out/test014.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test015: Branching, matching and recursion on lists"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test015.c")
$(mkRelFile "out/test015.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test016: Closure extension"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test016.c")
$(mkRelFile "out/test016.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test017: Recursion through higher-order functions"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test017.c")
$(mkRelFile "out/test017.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test018: Tail recursion through higher-order functions"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test018.c")
$(mkRelFile "out/test018.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test019: Dynamic closure extension"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test019.c")
$(mkRelFile "out/test019.out"),
2022-11-03 11:38:09 +03:00
PosTest
"Test020: Higher-order function composition"
2022-12-20 15:05:40 +03:00
$(mkRelDir ".")
$(mkRelFile "test020.c")
$(mkRelFile "out/test020.out")
2022-11-03 11:38:09 +03:00
]