Skip to content

Instantly share code, notes, and snippets.

@onlined
Created December 22, 2016 14:33
Show Gist options
  • Save onlined/736fcb81fa9b31b5ba29850bf4459f27 to your computer and use it in GitHub Desktop.
Save onlined/736fcb81fa9b31b5ba29850bf4459f27 to your computer and use it in GitHub Desktop.
Tester for CENG315 Take Home 1
#!/bin/bash
# Put Makefile, inputs and this script in the same directory.
files2=({x..z}{1,2})
files3=({a..f}{1,2})
make &>/dev/null
ok=true
for files in {files2[@],files3[@]}; do
for i in ${!files}; do
for j in ${!files}; do
if [[ $i > $j || $i == $j ]]; then
continue;
fi
if [[ ${i:0:1} == ${j:0:1} ]]; then
expected="equal"
else
expected="notequal"
fi
result=$(./runHK ${i}.txt ${j}.txt)
if [[ $result != $expected ]]; then
ok=false
echo "$i vs $j:"
echo "expected: $expected"
echo "your result: $result"
echo
fi
done
done
done
if $ok; then
echo "All tests are OK"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment