From dc0349df102935554f453a5d68a60f27fe38a09b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 19 Feb 2018 19:24:37 +0100 Subject: Add tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 00e76ec..24417a8 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,50 @@ loc.o: loc.c arg.h loc: loc.o $(CC) -o $@ loc.o $(LDFLAGS) -check: - true +check: loc + test "$$(./loc < tests/0)" = 0 + test "$$(./loc - < tests/0)" = 0 + test "$$(./loc tests/1 tests/2 | sed 's/: */: /')" = "$$(printf '%s\n' 'tests/1: 0' 'tests/2: 1')" + test "$$(./loc tests/0)" = 0 + test "$$(./loc tests/1)" = 0 + test "$$(./loc tests/2)" = 1 + test "$$(./loc tests/3)" = 0 + test "$$(./loc tests/4)" = 2 + test "$$(./loc tests/5)" = 2 + test "$$(./loc tests/6)" = 1 + test "$$(./loc tests/7)" = 0 + test "$$(./loc tests/8)" = 1 + test "$$(./loc tests/9)" = 1 + test "$$(./loc tests/10)" = 2 + test "$$(./loc tests/11)" = 0 + test "$$(./loc tests/12)" = 1 + test "$$(./loc tests/13)" = 2 + test "$$(./loc tests/14)" = 1 + test "$$(./loc tests/15)" = 0 + test "$$(./loc tests/16)" = 0 + test "$$(./loc tests/17)" = 1 + test "$$(./loc tests/18)" = 0 + test "$$(./loc tests/19)" = 1 + test "$$(./loc tests/20)" = 1 + test "$$(./loc tests/21)" = 1 + test "$$(./loc tests/22)" = 1 + test "$$(./loc tests/23)" = 1 + test "$$(./loc tests/24)" = 1 + test "$$(./loc tests/25)" = 0 + test "$$(./loc tests/26)" = 3 + test "$$(./loc tests/27)" = 3 + test "$$(./loc tests/28)" = 3 + test "$$(./loc tests/29)" = 3 + test "$$(./loc tests/30)" = 1 + test "$$(./loc tests/31)" = 1 + test "$$(./loc tests/32)" = 1 + test "$$(./loc tests/33)" = 1 + test "$$(./loc tests/34)" = 2 + test "$$(./loc tests/35)" = 2 + test "$$(./loc tests/36)" = 2 + test "$$(./loc tests/37)" = 1 + test "$$(./loc tests/38)" = 0 + test "$$(./loc tests/39)" = 1 install: loc mkdir -p -- "$(DESTDIR)$(PREFIX)/bin/" -- cgit v1.2.3-70-g09d2