Checker
Checker
What’s that ?
This small Node.JS script is used to test a program agains test cases. Program is supplied by *.in
files to the stdin
and it’s stdout
is compared agains *.out
files. It automates and presents nicely the results of running the tests.
To have even nicer output I recommend using my formatter by piping the checker to interactive formatter process without buffering:
check prog test c: | stdbuf -i0 -o0 formatter
Use cases
-
Learn more about checker and options
node check ?
-
Test program
prog
for all*.in
files in directorytests
and compare outputs with corresponding*.out
files:node check prog tests
-
Test program
prog
agains testsA
andB
in directorytests
and show diff for tests that differnode check showDiff: prog tests A B
-
Test program
prog
against all tests in directorytests
and additionaly store program’s output to filestests/*.out.tee
node check tee: prog tests
-
Generate
solutions/*.out.tee
files for each*.in
file in directorytests
for programbrute
node check gen:solutions brute tests
-
Test program
prog
for*.in
files agains*.out
in directorytests
, show colorful status report in terminal withc:
and piping toformatter
, show command used to launch each test case withshowCmd:
, store outputs from program to*.out.tee
files in the same directorytests
withtee:
anddiff
only with-b
flag for tests (assuming that my customformatter
is installed)node check color: tee: showCmd: diff: diffFlags:b prog tests | stdbuf -i0 -o0 formatter
TODO
- Add support for validator instead of
*.out
files - Support timeout to exec function in some
tests.lim
file as maptestName: time limit for timeout
or make each file start with some header specifying test parameters - Better differentiation of tests ending in runtime error / non zero exit code vs those that just diff differently (RE vs WA) - return error message on crash