diff options
| author | Vincent Richard <[email protected]> | 2004-10-05 12:28:21 +0200 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2004-10-05 12:28:21 +0200 |
| commit | a3229a051381e8f6b6df0fd423186166d20c898f (patch) | |
| tree | 29dab66e608651e50a9b6f4bf9ce28f2ee897c87 /tests/encoding/run-test.sh | |
| download | vmime-a3229a051381e8f6b6df0fd423186166d20c898f.tar.gz vmime-a3229a051381e8f6b6df0fd423186166d20c898f.zip | |
Initial import.
Diffstat (limited to 'tests/encoding/run-test.sh')
| -rwxr-xr-x | tests/encoding/run-test.sh | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/tests/encoding/run-test.sh b/tests/encoding/run-test.sh new file mode 100755 index 00000000..181f1daf --- /dev/null +++ b/tests/encoding/run-test.sh @@ -0,0 +1,118 @@ +#/bin/sh + +TEST_DIR="./test-suites" +TEMP_DIR="/tmp" +ENCODINGS="base64 quoted-printable uuencode" +PROGRAM="./main" + + +for encoding in $ENCODINGS ; do + + echo + echo Testing encoding \'$encoding\' + echo ===================================================================== + + + ############ + # Encode # + ############ + + echo ENCODE + + testFiles=`cd $TEST_DIR/encode ; find . -regex '\./[^\.]*' -maxdepth 1 -type f | tr -d ./` + + for testFile in $testFiles ; do + + if [ -e $TEST_DIR/encode/$testFile.$encoding ] + then + + printf %20s "$testFile : " + + $PROGRAM $encoding e < $TEST_DIR/encode/$testFile > $TEMP_DIR/vmime_result + + diff="diff $TEMP_DIR/vmime_result $TEST_DIR/encode/$testFile.$encoding" + res=`$diff` + + if [ "$res" = "" ] + then + echo "[OK]" + else + diffFile=$TEMP_DIR/vmime.encode.$encoding.$testFile.diff + echo "[NO: diff file is $diffFile]" + $diff > $diffFile + fi + + fi + + done + + + ############ + # Decode # + ############ + + echo DECODE [1/2] + + for testFile in $testFiles ; do + + if [ -e $TEST_DIR/encode/$testFile.$encoding ] + then + + printf %20s "$testFile : " + + $PROGRAM $encoding d < $TEST_DIR/encode/$testFile.$encoding > $TEMP_DIR/vmime_result + + diff="diff $TEMP_DIR/vmime_result $TEST_DIR/encode/$testFile" + res=`$diff` + + if [ "$res" = "" ] + then + echo "[OK]" + else + diffFile=$TEMP_DIR/vmime.decode.$encoding.$testFile.diff + echo "[NO: diff file is $diffFile]" + $diff > $diffFile + fi + + fi + + done + + + ########################################### + # Decode from data not encoded by VMime # + ########################################### + + echo DECODE [2/2] + + testFiles=`cd $TEST_DIR/decode ; find . -regex '\./[^\.]*' -maxdepth 1 -type f | tr -d ./` + + for testFile in $testFiles ; do + + if [ -e $TEST_DIR/decode/$testFile.$encoding ] + then + + printf %20s "$testFile : " + + $PROGRAM $encoding d < $TEST_DIR/decode/$testFile.$encoding > $TEMP_DIR/vmime_result + + diff="diff $TEMP_DIR/vmime_result $TEST_DIR/decode/$testFile" + res=`$diff` + + if [ "$res" = "" ] + then + echo "[OK]" + else + diffFile=$TEMP_DIR/vmime.decode2.$encoding.$testFile.diff + echo "[NO: diff file is $diffFile]" + $diff > $diffFile + fi + + fi + + done + +done + +echo + |
