Shaker is a simple checker script for competitive programmers. It compiles and checks your solution with only one command and provides a little structure to your workspace.
The directory structure is as follows,
-
srcdirectory contains all the solutions. -
inputsdirectory contains local test cases. The filename should be<name>.in. This file is going to piped into the program viastdin. -
expecteddirectory contains the expected results for the respective test cases ininputsdirectory. -
The
shakeris used as the build system. It is a python3 script. -
.editorconfigfile is for editorconfig plugin. Go here for more info.
To compile and run a file you should write
$ ./shaker <solution>It will compile the solution and keep it in bin folder which will be created via the shaker
If you provide another argument --expect to the command like this,
$ ./shaker <solution> --expectthen it will match the results of the solution to the expected result in expected/<solution>.txt
If you want to get rid of the binaries run,
$ ./shaker --cleanThis will delete the bin folder.
For example an example solution is given which adds to number. I called it add.
Thus, the binary name will be add (path bin/add) and the source file will be add.cpp (path src/add.cpp)
Note that I have also put some examples in other languages supported by the script.
The input file will be named add.in (path inputs/add.in).
To run this solution issue the command ./shaker add.cpp. This will pipe the input file and print the result on console
Issuing ./shaker add.cpp --expect will compare the output stream to expected/add.txt
You can try other examples like..
$ ./shaker add.go
$ ./shaker add.py
$ ./shaker add.c
$ ./shaker add.rsIf a program crashes the script will print the error and exit.
$ ./shaker crash.py
Traceback....
...
FAILURE