From: Martin Mares Date: Sun, 18 Nov 2007 19:25:26 +0000 (+0100) Subject: Added test cases for the tokenizing judge. X-Git-Tag: python-dummy-working~267 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=5da8c71a643e2c486b8bcdbd6dfbe8ec6cad6b1b;p=eval.git Added test cases for the tokenizing judge. --- diff --git a/judge/Makefile b/judge/Makefile index 149024e..686c240 100644 --- a/judge/Makefile +++ b/judge/Makefile @@ -13,10 +13,11 @@ judge-tok: LDLIBS+=-lm judge-shuff: judge-shuff.o $(JLIB) filter-cmt: filter-cmt.o $(JLIB) -tests: $(addsuffix .test,io token filter-cmt) +tests: $(addsuffix .test,io token filter-cmt judge-tok) io.test: test-io token.test: test-tok filter-cmt.test: filter-cmt +judge-tok.test: judge-tok %.test: %.t tester ./tester $< diff --git a/judge/judge-tok.t b/judge/judge-tok.t new file mode 100644 index 0000000..79943a4 --- /dev/null +++ b/judge/judge-tok.t @@ -0,0 +1,95 @@ +# Test cases for judge-tok.c + +# Identical input and output +Name: ok +Run: ./judge-tok $1 $2 +In1: abc d e fgh + ijk lmn +In2: abc d e fgh + ijk lmn + +# Differences in whitespaces are OK +Name: ws +Run: ./judge-tok $1 $2 +In1: abc d e fgh + ijk lmn +In2: abc d e fgh + ijk lmn + +# Differences in line breaks are not +Name: lines1 +Run: ./judge-tok $1 $2 +In1: abc d + e fgh + ijk lmn +In2: abc d e fgh + ijk lmn +Exit: 1 + +# ... unless the -n switch is given +Name: lines2 +Run: ./judge-tok -n $1 $2 +In1: abc d + e fgh + ijk lmn +In2: abc d e fgh + ijk lmn + +# Trailing empty lines are also not OK +Name: trail1 +Run: echo >>$1 && ./judge-tok $1 $2 +In1: abc d e fgh + ijk lmn +In2: abc d e fgh + ijk lmn +Exit: 1 + +# ... unless -t is given +Name: trail1 +Run: echo >>$1 && ./judge-tok -t $1 $2 +In1: abc d e fgh + ijk lmn +In2: abc d e fgh + ijk lmn + +# Differences in case are not +Name: case1 +Run: ./judge-tok $1 $2 +In1: abc d e FGH + IJK lmn +In2: abc d e fgh + ijk lmn +Exit: 1 + +# ... unless -i is given +Name: case2 +Run: ./judge-tok -i $1 $2 +In1: abc d e FGH + IJK lmn +In2: abc d e fgh + ijk lmn + +# By default, we compare everything literal +Name: real1 +Run: ./judge-tok $1 $2 +In1: 0.1000001 + 1. + 1e-50 + 1230000001 +In2: 0.1 + 1. + 0 + 1230000000 +Exit: 1 + +# ... but if -r is given, we allow small differences +Name: real2 +Run: ./judge-tok -r $1 $2 +In1: 0.1000001 + 1. + 1e-50 + 1230000001 +In2: 0.1 + 1. + 0 + 1230000000