1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/bin/sh
TEST_DIR="./test-suites"
TEMP_DIR="/tmp"
PROGRAM="./main"
testFiles=`cd $TEST_DIR ; find . -maxdepth 1 -regex '\./[^\.]*\.in\..*' -type f`
echo
echo Testing charset conversions
echo =====================================================================
for testFile in $testFiles ; do
testName=`echo $testFile | sed 's/^\.\/\([^\.]*\).*/\1/'`
sourceCharset=`echo $testFile | sed 's/^\.\/[^\.]*\.[^\.]*\.\(.*\)/\1/'`
testOutFiles=`cd $TEST_DIR ; find . -maxdepth 1 -regex "\./$testName\.out\..*" -type f`
for testOutFile in $testOutFiles ; do
destCharset=`echo $testOutFile | sed 's/^\.\/[^\.]*\.[^\.]*\.\(.*\)/\1/'`
printf %20s "$testName "
printf %30s "$sourceCharset --> $destCharset : "
$PROGRAM $sourceCharset $destCharset < $TEST_DIR/$testFile > $TEMP_DIR/vmime_result
diff="diff $TEMP_DIR/vmime_result $TEST_DIR/$testOutFile"
res=`$diff`
if [ "$res" = "" ]
then
echo "[OK]"
else
diffFile=$TEMP_DIR/vmime.charset.$testName.$sourceCharset.$destCharset.diff
echo "[NO: diff file is $diffFile]"
$diff > $diffFile
fi
done
done
echo
|