-
-
Save htor/7120418 to your computer and use it in GitHub Desktop.
For diffing log files.
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
#!/usr/bin/env bash | |
# | |
# test: diff logs against reference compiler logs | |
# usage: test [parser|scanner] [all|file] [log|res] | |
# | |
source_files=( easter float-opers gcd heron medium micro mini next opers primes strings wrong ) | |
mod_test=$1 | |
ext=$3 | |
compare() { | |
echo -n "diff ${1}.${2}? "; read diff | |
case $diff in [nN]) return ;; esac | |
vimdiff dev-files/${1}.${2} ref-files/${1}.${2} | |
} | |
compile() { | |
echo -n "compile ${2}.cflat? "; read compile | |
case $compile in [nN]) return ;; esac | |
java -jar Cflat-ref.jar -test${1} ref-files/${2}.cflat | |
java -jar Cflat.jar -test${1} dev-files/${2}.cflat | |
} | |
# all programs test | |
if [[ "$2" == all ]]; then | |
for file in ${source_files[@]}; do | |
compile $mod_test $file | |
compare $file $ext | |
done | |
exit | |
fi | |
# single program test | |
compile $mod_test $2 | |
compare $2 $ext |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment