Skip to content

Instantly share code, notes, and snippets.

@htor
Created October 23, 2013 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htor/7120418 to your computer and use it in GitHub Desktop.
Save htor/7120418 to your computer and use it in GitHub Desktop.
For diffing log files.
#!/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