Last active
May 14, 2018 18:55
-
-
Save felipecustodio/4342953977dc95124f6708c7510626b0 to your computer and use it in GitHub Desktop.
Run all .in test cases in tests/ folder, output to .out and compare. Useful for college assignments that provide lots of test cases with the expected outputs, like assignments on the run.codes website.
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
| #!/bin/bash | |
| shopt -s nullglob | |
| for ext in .in; do | |
| files=(tests/*"$ext") | |
| printf 'number of %s files: %d\n' "$ext" "${#files[@]}" | |
| for i in `seq 1 ${#files[@]}`; do | |
| rm results$i.out; | |
| printf "\nRunning test $i\n"; | |
| your program < tests/$i.in 2>&1 | tee tests/results$i.out; | |
| # vimdiff tests/results$i.out tests/$i.out; | |
| diff tests/results$i.out tests/$i.out; | |
| printf ".....................\n"; | |
| done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment