Skip to content

Instantly share code, notes, and snippets.

@Phhere
Created August 7, 2012 17:22
Show Gist options
  • Save Phhere/3287469 to your computer and use it in GitHub Desktop.
Save Phhere/3287469 to your computer and use it in GitHub Desktop.
#!/bin/bash
SOURCE_FILE=`ls *.c`
COUNT=$(echo "$SOURCE_FILE" | wc -w)
if [ $COUNT=0 ]; then
echo "Source File: $SOURCE_FILE"
gcc -o carcassonne $SOURCE_FILE
for ((i=1;i<=14;i++))
do
echo "Beispiel $i"
./carcassonne play "Tests/beispiel_$i/karten.txt" > /dev/null
OUTPUT_TOOL=`md5sum ausgabe.txt | awk '{ print $1 }'`
OUTPUT_EXPECTED=`md5sum "Tests/beispiel_$i/ausgabe.txt" | awk '{ print $1 }'`
echo $OUTPUT_TOOL
echo $OUTPUT_EXPECTED
if [ "$OUTPUT_TOOL" == "$OUTPUT_EXPECTED" ];then
echo "Korrekt"
else
echo "Fehlerhaft"
#diff ausgabe.txt "Tests/beispiel_$i/ausgabe.txt"
fi
echo ""
done
else
echo "Es gibt mehr als eine .c Datei:"
echo $SOURCE_FILE
fi
@derchrisuk
Copy link

!/bin/bash

gcc -o carcassone main.c
for ((i=1;i<=14;i++))
do
echo "Beispiel $i"
./carcassone play "Tests/beispiel_$i/karten.txt" > /dev/null
OUTPUT_TOOL=$(md5sum ausgabe.txt|awk '{print $1}')
OUTPUT_EXPECTED=$(md5sum "Tests/beispiel_$i/ausgabe.txt"|awk '{print $1}')
if ["$OUTPUT_TOOL" = "$OUTPUT_EXPECTED"];then
echo "Korrekt"
else
echo "Fehlerhaft:"
diff ausgabe.txt "Tests/beispiel_$i/ausgabe.txt"
fi
#md5sum ausgabe.txt
#md5sum "Tests/beispiel_$i/ausgabe.txt"
echo ""
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment