diff options
Diffstat (limited to 'tiger-compiler/tests/good/managing_values.tig')
| -rw-r--r-- | tiger-compiler/tests/good/managing_values.tig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tiger-compiler/tests/good/managing_values.tig b/tiger-compiler/tests/good/managing_values.tig new file mode 100644 index 0000000..231f9f4 --- /dev/null +++ b/tiger-compiler/tests/good/managing_values.tig @@ -0,0 +1,42 @@ +let + var i := 2 + var j := 92 + + function return_1(): int = 1 + function return_i(): int = i + + type ints = array of int + var arr := ints [5] of 0 +in + if (return_1() = 1) then + print("this is indeed equal to 1") + else ( + print("this is not to equal, this is "); + print_int(return_1()) + ); + + print("\n"); + flush(); + + if (j = i) then + print("j is now equal to i") + else ( + print("j is not equal, this is "); + print_int(j) + ); + + print("\n"); + flush(); + + j := return_i(); + + if (j = i) then + print("j is now equal to i") + else ( + print("this is not equal, this is "); + print_int(j) + ); + + print("\n"); + flush() +end |
