Added tests for "for" and arrays
git-svn-id: http://picoc.googlecode.com/svn/trunk@70 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
51afc538be
commit
7c9b3c1c8a
6
test/04_for.c
Normal file
6
test/04_for.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
int Count;
|
||||
|
||||
for (Count = 1; Count <= 10; Count++)
|
||||
{
|
||||
printint(Count);
|
||||
}
|
10
test/04_for.expect
Normal file
10
test/04_for.expect
Normal file
|
@ -0,0 +1,10 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
12
test/05_array.c
Normal file
12
test/05_array.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
int Count;
|
||||
int Array[10];
|
||||
|
||||
for (Count = 0; Count < 10; Count++)
|
||||
{
|
||||
Array[Count] = Count * Count;
|
||||
}
|
||||
|
||||
for (Count = 0; Count < 10; Count++)
|
||||
{
|
||||
printint(Array[Count]);
|
||||
}
|
10
test/05_array.example
Normal file
10
test/05_array.example
Normal file
|
@ -0,0 +1,10 @@
|
|||
1
|
||||
4
|
||||
9
|
||||
16
|
||||
25
|
||||
36
|
||||
49
|
||||
64
|
||||
81
|
||||
100
|
|
@ -1,9 +1,11 @@
|
|||
TESTS= 00_assignment.test \
|
||||
01_comment.test \
|
||||
02_printf.test \
|
||||
03_struct.test
|
||||
03_struct.test \
|
||||
04_for.test \
|
||||
05_array.test
|
||||
|
||||
%.test: %.expect %.c ../picoc
|
||||
%.test: %.expect %.c
|
||||
@echo Test: $*...
|
||||
-@../picoc $*.c 2>&1 >$*.output
|
||||
@if [ "x`diff -qu $*.expect $*.output`" != "x" ]; \
|
||||
|
@ -15,9 +17,6 @@ TESTS= 00_assignment.test \
|
|||
fi; \
|
||||
rm -f $*.output
|
||||
|
||||
%.output: %.c ../picoc
|
||||
@../picoc $< 2>&1 >$@
|
||||
|
||||
all: test
|
||||
|
||||
test: $(TESTS)
|
||||
|
|
Loading…
Reference in a new issue