A simple script to help with simple “Test Cases”
Just here to share a simple script I wrote to help with some test cases on university.
- What it does:
1- It takes all ".in" files it finds recursively on the folder and show how much time your algorithm takes to process each one.
2- For each ".in" file, it tries to find another one with the same name but with the ".out" extension. If it finds, it'll diff both that file and the output of the ".in" file and show if your algorithm is correct. If not, it shows the diff.
- The script:
Download it at: http://gist.github.com/631593. Name it as you wish! (In the explanations bellow I'll assume the default name "TestCases")
- How to use:
You can put the script anywhere and call it using it's absolute/relative path. If you want to call it just by it's name, make sure it's on your $PATH. To do so, add this to the end of your .bashrc:
export PATH="PATH/TO/SCRIPT":"${PATH}"
Make sure the ".in" and ".out" (if any) files are in the same folder (or in a sub-folder) of the executable you will test. Lets suppose the executable is called "EXECUTABLE" and you are on it's working directory...you can run the script like this:
TestCases EXECUTABLE
Watch the output and enjoy! ;D
The script is a Gist, so, if you want to improve the script, fork it! After you made the changes don't forget to tell me so I can pull your changes.
Related posts:
