Last active
January 31, 2018 12:40
-
-
Save liaujianjie/2472f9ed6d513ffa266b90fbf495706c to your computer and use it in GitHub Desktop.
Runs the tests for your CS1010 test cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Running $2 test cases for $1...\n\n" | |
for i in $(seq $2); | |
do echo "========== TEST CASE $i" | |
./a.out < $1$i.in > $1$i.out.actual | |
diff $1$i.out $1$i.out.actual | |
rm $1$i.out.actual; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is this
Lets you run all your test cases iteratively in a single command like this:
./test.sh wowdoge 6
If pass all test cases:
If fail some test cases:
✨✨✨✨✨ tested on sunfire ✨✨✨✨✨
Feel free to share with anyone.
How to install
test.sh
(yes, write/print this and bring it in and type it out in your PE)chmod u+x test.sh
(this gives the script permission to manipulate files)How to use
a.out
./test.sh <test_case_name> <test_case_count>
For example, if your test case file is
sudoku1.in
/sudoku1.out
and you have 4 test cases, then you should use this:./test.sh sudoku 4