mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-30 18:48:18 +00:00
Regression tests in interpretation only
This commit is contained in:
parent
1cfd3123be
commit
5527013a7f
15 changed files with 38 additions and 28 deletions
|
|
@ -9,7 +9,7 @@ check: $(TESTS)
|
|||
$(TESTS): %: %.expr
|
||||
@echo $@
|
||||
# @$(RC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log
|
||||
cat $@.input | $(RC) -i $< > $@.log && diff $@.log orig/$@.log
|
||||
cat $@.input | $(RC) -i $< > $@.log && diff $@.log orig/$@.log; true
|
||||
# @cat $@.input | $(RC) -s $< > $@.log && diff $@.log orig/$@.log
|
||||
|
||||
clean:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
local x, y, z;
|
||||
read (x);
|
||||
read (y);
|
||||
x := read ();
|
||||
y := read ();
|
||||
z := x*y*3;
|
||||
write (z)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun fib (n) local r {
|
||||
fun fib (n) {
|
||||
local r;
|
||||
if n <= 1
|
||||
then result := 1
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun test (n, m) local i, s {
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
s := 0;
|
||||
for i := 0, i <= n, i := i + 1 do
|
||||
s := s + i;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun printArray (x) local elem {
|
||||
fun printArray (x) {
|
||||
local elem;
|
||||
if x.length == 0 then return fi;
|
||||
for i:=0, i<x.length, i:=i+1 do
|
||||
write (x[i])
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun sort (x) local i, j, y, n {
|
||||
fun sort (x) {
|
||||
local i, j, y, n;
|
||||
n := x.length;
|
||||
|
||||
if n == 0 then return x fi;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun printString (s) local i {
|
||||
fun printString (s) {
|
||||
local i;
|
||||
for i := 0, i < s.length, i := i + 1 do
|
||||
write (s[i])
|
||||
od
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun collect_ints_acc (v, tail) local i {
|
||||
fun collect_ints_acc (v, tail) {
|
||||
local i;
|
||||
case v of
|
||||
a@#unboxed -> return Cons (a, tail)
|
||||
| #string -> return tail
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun test (n, m) local i, s {
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
write (n);
|
||||
write (m);
|
||||
return n
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fun test (n, m) local i, s {
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
s := 0;
|
||||
for i := 0, i <= n, i := i + 1 do
|
||||
s := s + i;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ fun print_list (l) {
|
|||
esac
|
||||
}
|
||||
|
||||
fun array_to_list (a) local l, i {
|
||||
fun array_to_list (a) {
|
||||
local l, i;
|
||||
l := {};
|
||||
for i := a.length, i > 0, i := i-1 do
|
||||
l := a[i-1] : l
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
infix "===" at "==" (v1, v2) local s1, s2, i {
|
||||
infix "===" at "==" (v1, v2) {
|
||||
local s1, s2, i;
|
||||
|
||||
s1 := v1.string;
|
||||
s2 := v2.string;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue