diff options
Diffstat (limited to 'tiger-compiler/tests/testsuite/good/subtests.tig')
| -rw-r--r-- | tiger-compiler/tests/testsuite/good/subtests.tig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tiger-compiler/tests/testsuite/good/subtests.tig b/tiger-compiler/tests/testsuite/good/subtests.tig new file mode 100644 index 0000000..87ff369 --- /dev/null +++ b/tiger-compiler/tests/testsuite/good/subtests.tig @@ -0,0 +1,24 @@ +// test_proceed should not be considered unit tests + +function test_letexp() = + let + var a := 10 + var b := 20 + + function add(x: int, y: int): int = x + y + function sub(x: int, y: int): int = x - y + function mul(x: int, y: int): int = x * y + + function test_proceed() = + let + function test_result(actual: int, expected: int) = assert actual = expected + in + ( + test_result(add(a, b), 30); + test_result(sub(a, b), -10); + test_result(mul(a, b), 200) + ) + end + in + test_proceed() + end |
