diff --git a/test/03_struct.c b/test/03_struct.c new file mode 100644 index 0000000..a8dd746 --- /dev/null +++ b/test/03_struct.c @@ -0,0 +1,13 @@ +struct fred +{ + int boris; + int natasha; +}; + +struct fred bloggs; + +bloggs.boris = 12; +bloggs.natasha = 34; + +printint(bloggs.boris); +printint(bloggs.natasha); diff --git a/test/03_struct.expect b/test/03_struct.expect new file mode 100644 index 0000000..8e994dd --- /dev/null +++ b/test/03_struct.expect @@ -0,0 +1,2 @@ +12 +34 diff --git a/test/Makefile b/test/Makefile index b897a13..4508a6f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,7 @@ TESTS= 00_assignment.test \ 01_comment.test \ - 02_printf.test + 02_printf.test \ + 03_struct.test %.test: %.expect %.c ../picoc @echo Test: $*... @@ -9,6 +10,7 @@ TESTS= 00_assignment.test \ then \ echo "error in test $*"; \ diff -u $*.expect $*.output; \ + rm -f $*.output; \ exit 1; \ fi; \ rm -f $*.output