From 7c9b3c1c8a3a1835cbae1d1a5dbe6ab211738bd4 Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Tue, 10 Feb 2009 11:18:50 +0000 Subject: [PATCH] Added tests for "for" and arrays git-svn-id: http://picoc.googlecode.com/svn/trunk@70 21eae674-98b7-11dd-bd71-f92a316d2d60 --- test/04_for.c | 6 ++++++ test/04_for.expect | 10 ++++++++++ test/05_array.c | 12 ++++++++++++ test/05_array.example | 10 ++++++++++ test/Makefile | 9 ++++----- 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 test/04_for.c create mode 100644 test/04_for.expect create mode 100644 test/05_array.c create mode 100644 test/05_array.example 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)