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:
parent
6a1d28c1dc
commit
65db9a490a
8
tests/07_function.c
Normal file
8
tests/07_function.c
Normal 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
2
tests/07_function.expect
Normal file
|
@ -0,0 +1,2 @@
|
|||
9
|
||||
16
|
15
tests/08_while.c
Normal file
15
tests/08_while.c
Normal 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
11
tests/08_while.expect
Normal file
|
@ -0,0 +1,11 @@
|
|||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
8
|
||||
13
|
||||
21
|
||||
34
|
||||
55
|
||||
89
|
16
tests/09_do_while.c
Normal file
16
tests/09_do_while.c
Normal 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
11
tests/09_do_while.expect
Normal file
|
@ -0,0 +1,11 @@
|
|||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
8
|
||||
13
|
||||
21
|
||||
34
|
||||
55
|
||||
89
|
|
@ -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: $*...
|
||||
|
|
Loading…
Reference in a new issue