Issue: #850. More test script refactoring. See SVN: 2935.
This commit is contained in:
+132
-1
@@ -6,9 +6,11 @@ export LC_ALL=C
|
||||
|
||||
##
|
||||
# initialize globals
|
||||
|
||||
this=$(basename $0 .sh)
|
||||
here=$PWD
|
||||
datapath="../data"
|
||||
testdir="$here/tmp"
|
||||
datadir="../data"
|
||||
|
||||
if [ -z "$EXIV2_BINDIR" ] ; then
|
||||
bin="$here/../bin"
|
||||
@@ -61,6 +63,13 @@ existsTest()
|
||||
echo $result
|
||||
}
|
||||
|
||||
##
|
||||
# copy file
|
||||
copy()
|
||||
{
|
||||
\cp "$1" "$2"
|
||||
}
|
||||
|
||||
##
|
||||
# copy file from data to tmp (copyTestFile from to
|
||||
copyTestFile()
|
||||
@@ -123,6 +132,13 @@ reportTest()
|
||||
|
||||
##
|
||||
# moved here from write-test.sh
|
||||
# Function:
|
||||
# runTestCase number file
|
||||
# Params:
|
||||
# number: Test case number
|
||||
# file : Input file
|
||||
# Abstract:
|
||||
# Run the requested test case number with the given file
|
||||
runTestCase()
|
||||
{
|
||||
rtc_number=$1
|
||||
@@ -234,6 +250,121 @@ diffCheck()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# moved here from iotest.sh
|
||||
ioTest()
|
||||
{
|
||||
src=$datapath/$1
|
||||
out1=${1}.1
|
||||
out2=${1}.2
|
||||
|
||||
#run tests
|
||||
runTest iotest $src $out1 $out2
|
||||
if [ $? -ne 0 ]; then
|
||||
errors=`expr $errors + 1`
|
||||
return
|
||||
fi
|
||||
|
||||
#check results
|
||||
diffCheck $out1 $src
|
||||
diffCheck $out2 $src
|
||||
printf "."
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# moved here from iptctest.sh
|
||||
printTest()
|
||||
{
|
||||
src=$1
|
||||
test=${src}.iptst
|
||||
good=$datapath/${src}.ipgd
|
||||
|
||||
#run tests
|
||||
runTest iptcprint $datapath/$src > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
printf "."
|
||||
}
|
||||
|
||||
removeTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.irtst
|
||||
good=$datapath/${src}.irgd
|
||||
|
||||
#setup
|
||||
cp $datapath/$src $tmp
|
||||
|
||||
#run tests
|
||||
runTest iptctest $tmp <<-eoc
|
||||
r Iptc.Application2.Byline
|
||||
r Iptc.Application2.Caption
|
||||
r Iptc.Application2.Keywords
|
||||
r Iptc.Application2.Keywords
|
||||
r Iptc.Application2.Keywords
|
||||
r Iptc.Application2.CountryName
|
||||
eoc
|
||||
runTest iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
printf "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
addModTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.iatst
|
||||
good=$datapath/${src}.iagd
|
||||
|
||||
#setup
|
||||
cp $datapath/$src $tmp
|
||||
|
||||
#run tests
|
||||
runTest iptctest $tmp <<-eoc
|
||||
a Iptc.Application2.Headline The headline I am
|
||||
a Iptc.Application2.Keywords Yet another keyword
|
||||
m Iptc.Application2.DateCreated 2004-8-3
|
||||
a Iptc.Application2.Urgency 3
|
||||
m Iptc.Application2.SuppCategory "bla bla ba"
|
||||
a Iptc.Envelope.ModelVersion 2
|
||||
a Iptc.Envelope.TimeSent 14:41:0-05:00
|
||||
a Iptc.Application2.RasterizedCaption 230 42 34 2 90 84 23 146
|
||||
eoc
|
||||
runTest iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
printf "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
extendedTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.ixtst
|
||||
good=$datapath/${src}.ixgd
|
||||
|
||||
#setup
|
||||
cp $datapath/$src $tmp
|
||||
|
||||
#run tests
|
||||
runTest iptctest $tmp < $datapath/ext.dat
|
||||
runTest iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
printf "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
##
|
||||
# prepare temp files
|
||||
prepareTest()
|
||||
|
||||
Reference in New Issue
Block a user