summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/testsuite/good/subtests.tig
blob: 87ff3697214c189f42b546e538b850ebb6741d33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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