aboutsummaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-02-01 21:57:54 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-02-01 21:57:54 +0100
commit5b9de776ba7de654fa92bee7c38fb30d7929405d (patch)
tree9326e2f44b56f050df229eef331a3ab6248ebbdb /progs
parentf9b6a64b845dabdf1773da49f248def479659934 (diff)
downloadsylt-5b9de776ba7de654fa92bee7c38fb30d7929405d.tar.gz
.tdy -> .sy and tests -> progs/tests
Diffstat (limited to 'progs')
-rw-r--r--progs/tests/faulty.sy3
-rw-r--r--progs/tests/fib.sy9
-rw-r--r--progs/tests/for.sy19
-rw-r--r--progs/tests/scoping.sy13
-rw-r--r--progs/tests/simple.sy2
-rw-r--r--progs/tests/unreachable.sy1
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 @@
+<!>