mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Control constructs
This commit is contained in:
parent
a60a491e73
commit
8409f69983
9 changed files with 98 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test015 test017 test018 test019 test020 test021 test022 test023
|
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test013 test014 test015 test016 test017 test018 test019 test020 test021 test022 test023
|
||||||
|
|
||||||
RC=../src/rc.opt
|
RC=../src/rc.opt
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,8 @@
|
||||||
40320
|
> 10
|
||||||
|
11
|
||||||
|
10
|
||||||
|
11
|
||||||
|
3
|
||||||
|
2
|
||||||
|
1
|
||||||
|
0
|
||||||
|
|
|
||||||
31
regression/orig/test014.log
Normal file
31
regression/orig/test014.log
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
> 1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
16
regression/test013.expr
Normal file
16
regression/test013.expr
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
read (n);
|
||||||
|
|
||||||
|
repeat
|
||||||
|
|
||||||
|
if n == 1 then write (0)
|
||||||
|
elif n == 2 then write (1)
|
||||||
|
elif n == 3 then write (2)
|
||||||
|
elif n == 4 then write (3)
|
||||||
|
else write (10)
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if n >= 5 then write (11) fi;
|
||||||
|
|
||||||
|
n := n - 1
|
||||||
|
|
||||||
|
until n == 0
|
||||||
1
regression/test013.input
Normal file
1
regression/test013.input
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
6
|
||||||
27
regression/test014.expr
Normal file
27
regression/test014.expr
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
read (n);
|
||||||
|
|
||||||
|
while n > 0 do
|
||||||
|
|
||||||
|
if n < 1000
|
||||||
|
then
|
||||||
|
if n < 500
|
||||||
|
then
|
||||||
|
if n < 250
|
||||||
|
then
|
||||||
|
if n < 125
|
||||||
|
then
|
||||||
|
if n < 63
|
||||||
|
then
|
||||||
|
if n < 32
|
||||||
|
then
|
||||||
|
write (1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi;
|
||||||
|
|
||||||
|
n := n - 1
|
||||||
|
|
||||||
|
od
|
||||||
1
regression/test014.input
Normal file
1
regression/test014.input
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
100
|
||||||
12
regression/test016.expr
Normal file
12
regression/test016.expr
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
read (n);
|
||||||
|
|
||||||
|
s := 1;
|
||||||
|
|
||||||
|
repeat
|
||||||
|
|
||||||
|
s := s * n;
|
||||||
|
n := n - 1
|
||||||
|
|
||||||
|
until n == 0;
|
||||||
|
|
||||||
|
write (s)
|
||||||
1
regression/test016.input
Normal file
1
regression/test016.input
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
10
|
||||||
Loading…
Add table
Add a link
Reference in a new issue