diff --git a/test/04_for.c b/test/04_for.c new file mode 100644 index 0000000..97be0ff --- /dev/null +++ b/test/04_for.c @@ -0,0 +1,6 @@ +int Count; + +for (Count = 1; Count <= 10; Count++) +{ + printint(Count); +} diff --git a/test/04_for.expect b/test/04_for.expect new file mode 100644 index 0000000..f00c965 --- /dev/null +++ b/test/04_for.expect @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/test/05_array.c b/test/05_array.c new file mode 100644 index 0000000..4d96616 --- /dev/null +++ b/test/05_array.c @@ -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]); +} diff --git a/test/05_array.example b/test/05_array.example new file mode 100644 index 0000000..bc7257c --- /dev/null +++ b/test/05_array.example @@ -0,0 +1,10 @@ +1 +4 +9 +16 +25 +36 +49 +64 +81 +100 diff --git a/test/Makefile b/test/Makefile index 4508a6f..f49c0f9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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)