diff options
Diffstat (limited to 'progs/tests')
| -rw-r--r-- | progs/tests/faulty.sy | 3 | ||||
| -rw-r--r-- | progs/tests/fib.sy | 9 | ||||
| -rw-r--r-- | progs/tests/for.sy | 19 | ||||
| -rw-r--r-- | progs/tests/scoping.sy | 13 | ||||
| -rw-r--r-- | progs/tests/simple.sy | 2 | ||||
| -rw-r--r-- | progs/tests/unreachable.sy | 1 |
6 files changed, 47 insertions, 0 deletions
diff --git a/progs/tests/faulty.sy b/progs/tests/faulty.sy new file mode 100644 index 0000000..369b8ff --- /dev/null +++ b/progs/tests/faulty.sy @@ -0,0 +1,3 @@ +asdflökja;;;; +123 +asd diff --git a/progs/tests/fib.sy b/progs/tests/fib.sy new file mode 100644 index 0000000..1dde6a8 --- /dev/null +++ b/progs/tests/fib.sy @@ -0,0 +1,9 @@ +a := 0 +b := 1 + +for i := 0, i < 90, i = i + 1 { + c := a + a = b + b = c + b +} +a <=> 2880067194370816120 diff --git a/progs/tests/for.sy b/progs/tests/for.sy new file mode 100644 index 0000000..a9f8cd2 --- /dev/null +++ b/progs/tests/for.sy @@ -0,0 +1,19 @@ +a := 0 +for i := 0, i < 3, i = i + 1 { + a = a + i +} +a <=> 3 + +a = 0 +for i := 0, i <= 3, i = i + 1 { + a = a + i +} +a <=> 6 + +a = 0 +for i := 0, i < 3, i = i + 1 { + for j := 0, j < 3, j = j + 1 { + a = a + i * j + } +} +a <=> 9 diff --git a/progs/tests/scoping.sy b/progs/tests/scoping.sy new file mode 100644 index 0000000..7679948 --- /dev/null +++ b/progs/tests/scoping.sy @@ -0,0 +1,13 @@ +a : int = 1 +{ + a <=> 1 + a : int = a + a + a <=> 2 +} +a <=> 1 + +{ + a = 2 + a : int = 1 +} +a <=> 2 diff --git a/progs/tests/simple.sy b/progs/tests/simple.sy new file mode 100644 index 0000000..12a43c0 --- /dev/null +++ b/progs/tests/simple.sy @@ -0,0 +1,2 @@ +print extern_test(3.0) +print extern_test(3.0, 4.0, 5.0) diff --git a/progs/tests/unreachable.sy b/progs/tests/unreachable.sy new file mode 100644 index 0000000..f016a14 --- /dev/null +++ b/progs/tests/unreachable.sy @@ -0,0 +1 @@ +<!> |
