summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/testsuite/good/every_single_case.tig
blob: a2fd92360478701fc219421abc256b93aad24c29 (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
25
26
27
28
function test_valid_1() = assert 1 = 1

function test_valid_2() = assert 2 = 2

function test_assertion_failure() = assert 2 = 1

function test_runtime_failure() =
  (
    substring("abc", 5, 2);
    ()
  )

function test_segmentation_fault() =
  let
    type rectype = {name : string, age : int}
    var nobody: rectype := nil
  in
    nobody.age := nobody.age + 1
  end

function test_invalid_operation() =
  let
    var i := 1
    var j := 2
  in
    j := j - 2;
    i := i / j
  end