]> mj.ucw.cz Git - moe.git/commitdiff
Added tests for the comment filter and fixed a bug there.
authorMartin Mares <mj@ucw.cz>
Sun, 18 Nov 2007 19:06:40 +0000 (20:06 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Nov 2007 19:06:40 +0000 (20:06 +0100)
judge/Makefile
judge/filter-cmt.c
judge/filter-cmt.t [new file with mode: 0644]

index ccb9838e585e7a2591f9a61267e0ec4db7a25bdc..149024e78df49fc3ef1404ed9d246411c34acf65 100644 (file)
@@ -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 $<
index 12978ad4a7df28652f8959bbf2b917accd95f867..a7fb8cb472deb38e9b6122285f3137c6d9f7c60c 100644 (file)
@@ -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 (file)
index 0000000..67adf9a
--- /dev/null
@@ -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