From: Martin Mares Date: Sun, 18 Nov 2007 19:06:40 +0000 (+0100) Subject: Added tests for the comment filter and fixed a bug there. X-Git-Tag: python-dummy-working~268 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=db5e7df236e6f7e30f28f62405acd1e4f92f072f;p=moe.git Added tests for the comment filter and fixed a bug there. --- diff --git a/judge/Makefile b/judge/Makefile index ccb9838..149024e 100644 --- a/judge/Makefile +++ b/judge/Makefile @@ -13,9 +13,10 @@ judge-tok: LDLIBS+=-lm judge-shuff: judge-shuff.o $(JLIB) filter-cmt: filter-cmt.o $(JLIB) -tests: $(addsuffix .test,io token) +tests: $(addsuffix .test,io token filter-cmt) io.test: test-io token.test: test-tok +filter-cmt.test: filter-cmt %.test: %.t tester ./tester $< diff --git a/judge/filter-cmt.c b/judge/filter-cmt.c index 12978ad..a7fb8cb 100644 --- a/judge/filter-cmt.c +++ b/judge/filter-cmt.c @@ -23,7 +23,10 @@ int main(void) while ((c = sgetc(i)) >= 0 && c != '\n') ; if (nl) - continue; + { + c = sgetc(i); + continue; + } } else { diff --git a/judge/filter-cmt.t b/judge/filter-cmt.t new file mode 100644 index 0000000..67adf9a --- /dev/null +++ b/judge/filter-cmt.t @@ -0,0 +1,11 @@ +# Test cases for filter-cmt.c + +Run: ./filter-cmt +In: abc//comment + de///fgh + //full-line comment + //another full-line comment + lastline +Out: abc + de + lastline