Skip to content

Instantly share code, notes, and snippets.

@vinnyoodles
Created February 4, 2017 23:19
Show Gist options
  • Save vinnyoodles/21bf5ea7ba9f18c82aa5550b46f7247e to your computer and use it in GitHub Desktop.
Save vinnyoodles/21bf5ea7ba9f18c82aa5550b46f7247e to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Compiling source code"
javac ../src/Minor/P2/DS/BST.java
mv ../src/Minor/P2/DS/*.class Minor/P2/DS
java -jar BSTGenerator.jar
echo "Running test"
java testDriver
files=(TestCap.txt TestDeletion.txt TestEquals.txt TestInsertion.txt TestIsEmpty.txt TestNodeInitialization.txt TestPool.txt TestSearch.txt TestTreeInitialization.txt)
current=0
total=0
for i in ${files[@]}; do
echo ${i}
line=$(java -jar LogComparator.jar prof${i} ${i} | tail -n 1)
echo " $line"
score=$(echo "$line" | cut -c 8-)
array=(${score//// })
foo=${array[0]}
bar=${array[1]}
foolen="$(echo ${foo} | tr -d '[:space:]' | awk '{print length}')"
barlen="$(echo ${bar} | tr -d '[:space:]' | awk '{print length}')"
len=$((foolen - 3))
count="$(echo ${foo} | head -c ${len})"
a=$((barlen - 3))
b="$(echo ${bar} | head -c ${a})"
current=$((current + count))
total=$((total + b))
echo ""
done
echo Total: ${current} / ${total}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment