Function tests in interpretation

This commit is contained in:
Dmitry Boulytchev 2018-04-03 08:05:10 +03:00
parent 44b8a96e34
commit 784cc6510d
7 changed files with 65 additions and 1 deletions

View file

@ -1,4 +1,4 @@
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test013 test014 test015 test016 test017 test018 test019 test020 test021 test022 test023 test024 test025 test026 test027 test028 test029 test030 test031
TESTS=$(basename $(wildcard test*.expr))
RC=../src/rc.opt

View file

@ -0,0 +1,36 @@
> 1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
10
3
5
7
9
11
13
15
17
19
5
13
29
61
125
253
509
1021
2045

View file

@ -0,0 +1,2 @@
> 55
15

12
regression/test032.expr Normal file
View file

@ -0,0 +1,12 @@
fun ack (m, n) {
if m == 0 then return n+1
elif m > 0 && n == 0 then return ack (m-1, 1)
else return ack (m-1, ack (m, n-1))
fi
}
for m := 0, m <= 3, m := m+1 do
for n := 0, n <= 8, n := n+1 do
write (ack (m, n))
od
od

1
regression/test032.input Normal file
View file

@ -0,0 +1 @@
0

12
regression/test033.expr Normal file
View file

@ -0,0 +1,12 @@
fun test (n, m) local i, s {
s := 0;
for i := 0, i <= n, i := i + 1 do
s := s + i;
if s > m then return s fi
od;
return s
}
write (test (10, 100));
write (test (100, 10))

1
regression/test033.input Normal file
View file

@ -0,0 +1 @@
0