Added tests for functions, while and do..while

git-svn-id: http://picoc.googlecode.com/svn/trunk@88 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-02-19 11:00:51 +00:00
parent 6a1d28c1dc
commit 65db9a490a
7 changed files with 67 additions and 1 deletions

8
tests/07_function.c Normal file
View file

@ -0,0 +1,8 @@
int myfunc(int x)
{
return x * x;
}
printint(myfunc(3));
printint(myfunc(4));

2
tests/07_function.expect Normal file
View file

@ -0,0 +1,2 @@
9
16

15
tests/08_while.c Normal file
View file

@ -0,0 +1,15 @@
int a;
int p;
int t;
a = 1;
p = 0;
t = 0;
while (a < 100)
{
printint(a);
t = a;
a = t + p;
p = t;
}

11
tests/08_while.expect Normal file
View file

@ -0,0 +1,11 @@
1
1
2
3
5
8
13
21
34
55
89

16
tests/09_do_while.c Normal file
View file

@ -0,0 +1,16 @@
int a;
int p;
int t;
a = 1;
p = 0;
t = 0;
do
{
printint(a);
t = a;
a = t + p;
p = t;
} while (a < 100);

11
tests/09_do_while.expect Normal file
View file

@ -0,0 +1,11 @@
1
1
2
3
5
8
13
21
34
55
89

View file

@ -4,7 +4,10 @@ TESTS= 00_assignment.test \
03_struct.test \
04_for.test \
05_array.test \
06_case.test
06_case.test \
07_function.test \
08_while.test \
09_do_while.test
%.test: %.expect %.c
@echo Test: $*...