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
progfor all*.infiles in directorytestsand compare outputs with corresponding*.outfiles:node check prog tests -
Test program
progagains testsAandBin directorytestsand show diff for tests that differnode check showDiff: prog tests A B -
Test program
progagainst all tests in directorytestsand additionaly store program’s output to filestests/*.out.teenode check tee: prog tests -
Generate
solutions/*.out.teefiles for each*.infile in directorytestsfor programbrutenode check gen:solutions brute tests -
Test program
progfor*.infiles agains*.outin 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.teefiles in the same directorytestswithtee:anddiffonly with-bflag for tests (assuming that my customformatteris installed)node check color: tee: showCmd: diff: diffFlags:b prog tests | stdbuf -i0 -o0 formatter
TODO
- Add support for validator instead of
*.outfiles - Support timeout to exec function in some
tests.limfile as maptestName: time limit for timeoutor 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