Skip to content

Instantly share code, notes, and snippets.

@MikeShi42
Created January 28, 2016 20:38
Show Gist options
  • Save MikeShi42/f0e8ba191d1636301092 to your computer and use it in GitHub Desktop.
Save MikeShi42/f0e8ba191d1636301092 to your computer and use it in GitHub Desktop.
CSE100 PA2 Bash Tester
#!/bin/sh
# WARNING: It'll DELETE files called "compressed" "decompressed" "ref_compressed" if that's important
# This tests all files in input_files directory. Place in pa2 project root folder.
# It's pretty janky, it will output the diff if there's something wrong
# It'll discard all output by compress, uncompress, and ref_compress
# It also prints out the file sizes so you can check your file size against ref compress
# Code is pretty straight foward, should def read before using. Use at your own risk.
TEST_INPUTS=input_files/*
for f in $TEST_INPUTS
do
echo -e "-- Testing $f -- \n"
./compress $f compressed &> /dev/null
./uncompress compressed decompressed &> /dev/null
diff decompressed $f
./refcompress $f ref_compressed &> /dev/null
echo " == your compressed == "
stat -c %s compressed
echo " == ref compressed == "
stat -c %s ref_compressed
echo " == original == "
stat -c %s $f
echo -e "== $f done == \n\n\n\n============== \n\n\n\n"
done
rm compressed
rm decompressed
rm ref_compressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment