Moved test drivers to ../test/
parent
95bd3d8312
commit
ab80032a42
@ -1,104 +0,0 @@
|
||||
#! /bin/bash
|
||||
# Test driver for image file i/o
|
||||
|
||||
eraseTest()
|
||||
{
|
||||
src=$1
|
||||
test=${src}.etst
|
||||
good=${src}.egd
|
||||
|
||||
#setup
|
||||
cp $src $test
|
||||
|
||||
#run tests
|
||||
../src/metacopy $test $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
}
|
||||
|
||||
copyTest()
|
||||
{
|
||||
num=$1
|
||||
src=$2
|
||||
dst=$3
|
||||
test=${dst}.c${num}tst
|
||||
good=${dst}.c${num}gd
|
||||
|
||||
#setup
|
||||
cp $dst $test
|
||||
|
||||
#run tests
|
||||
../src/metacopy -a $src $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
}
|
||||
|
||||
iptcTest()
|
||||
{
|
||||
num=$1
|
||||
src=$2
|
||||
dst=$3
|
||||
test=${dst}.i${num}tst
|
||||
good=${dst}.i${num}gd
|
||||
|
||||
#setup
|
||||
cp $dst $test
|
||||
|
||||
#run tests
|
||||
../src/metacopy -ip $src $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
}
|
||||
|
||||
|
||||
# Make sure to pass the test file first and the known good file second
|
||||
diffCheck()
|
||||
{
|
||||
test=$1
|
||||
good=$2
|
||||
|
||||
#run diff and check results
|
||||
diff -q --binary $test $good
|
||||
if [ $? -ne 0 ]; then
|
||||
let ++errors
|
||||
else
|
||||
rm $test
|
||||
fi
|
||||
}
|
||||
|
||||
test_files="table.jpg smiley1.jpg smiley2.jpg"
|
||||
|
||||
let errors=0
|
||||
cd ../test
|
||||
echo
|
||||
|
||||
echo -n "Erase all tests"
|
||||
for i in $test_files; do eraseTest $i; done
|
||||
eraseTest "glider.exv" #extra test
|
||||
|
||||
echo -ne "\nCopy all tests"
|
||||
let c=0
|
||||
for src in $test_files; do
|
||||
let ++c
|
||||
for dst in $test_files; do copyTest $c $src $dst; done
|
||||
done
|
||||
|
||||
echo -ne "\nCopy iptc tests"
|
||||
let c=0
|
||||
for src in $test_files; do
|
||||
let ++c
|
||||
for dst in $test_files; do iptcTest $c $src $dst; done
|
||||
done
|
||||
|
||||
echo -e "\n---------------------------------------------------------"
|
||||
if [ $errors -eq 0 ]; then
|
||||
echo 'All test cases passed'
|
||||
else
|
||||
echo $errors 'test case(s) failed!'
|
||||
fi
|
@ -1,133 +0,0 @@
|
||||
#! /bin/bash
|
||||
# Test driver for Iptc metadata
|
||||
|
||||
printTest()
|
||||
{
|
||||
src=$1
|
||||
test=${src}.iptst
|
||||
good=${src}.ipgd
|
||||
|
||||
#run tests
|
||||
../src/iptcprint $src > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
}
|
||||
|
||||
removeTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.irtst
|
||||
good=${src}.irgd
|
||||
|
||||
#setup
|
||||
cp $src $tmp
|
||||
|
||||
#run tests
|
||||
../src/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
|
||||
../src/iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
addModTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.iatst
|
||||
good=${src}.iagd
|
||||
|
||||
#setup
|
||||
cp $src $tmp
|
||||
|
||||
#run tests
|
||||
../src/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
|
||||
../src/iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
extendedTest()
|
||||
{
|
||||
src=$1
|
||||
tmp="temp"
|
||||
test=${src}.ixtst
|
||||
good=${src}.ixgd
|
||||
|
||||
#setup
|
||||
cp $src $tmp
|
||||
|
||||
#run tests
|
||||
../src/iptctest $tmp < ext.dat
|
||||
../src/iptcprint $tmp > $test
|
||||
|
||||
#check results
|
||||
diffCheck $test $good
|
||||
echo -n "."
|
||||
rm $tmp
|
||||
}
|
||||
|
||||
|
||||
# Make sure to pass the test file first and the known good file second
|
||||
diffCheck()
|
||||
{
|
||||
test=$1
|
||||
good=$2
|
||||
|
||||
#run diff and check results
|
||||
diff -q --strip-trailing-cr $test $good
|
||||
if [ $? -ne 0 ]; then
|
||||
let ++errors
|
||||
else
|
||||
rm $test
|
||||
fi
|
||||
}
|
||||
|
||||
test_files="smiley1.jpg smiley2.jpg glider.exv table.jpg"
|
||||
|
||||
let errors=0
|
||||
cd ../test
|
||||
echo
|
||||
|
||||
echo -n "Read tests"
|
||||
for i in $test_files; do printTest $i; done
|
||||
|
||||
echo -ne "\nRemove tests"
|
||||
for i in $test_files; do removeTest $i; done
|
||||
|
||||
echo -ne "\nAdd/Mod tests"
|
||||
for i in $test_files; do addModTest $i; done
|
||||
|
||||
echo -ne "\nExtended tests"
|
||||
for i in $test_files; do extendedTest $i; done
|
||||
|
||||
echo -e "\n---------------------------------------------------------"
|
||||
if [ $errors -eq 0 ]; then
|
||||
echo 'All test cases passed'
|
||||
else
|
||||
echo $errors 'test case(s) failed!'
|
||||
fi
|
@ -1,53 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Test driver for the write unit tests
|
||||
|
||||
# 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
|
||||
rtc_infile=$2
|
||||
|
||||
rtc_outfile=test${rtc_number}.jpg
|
||||
rtc_jpgthumb=thumb${rtc_number}.jpg
|
||||
rtc_tifthumb=thumb${rtc_number}.tif
|
||||
|
||||
rm -f $rtc_outfile $rtc_jpgthumb $rtc_tifthumb
|
||||
rm -f iii ttt;
|
||||
|
||||
echo "------------------------------------------------------------"
|
||||
./exifprint $rtc_infile > iii;
|
||||
cp $rtc_infile $rtc_outfile;
|
||||
./write-test $rtc_infile $rtc_number > ttt;
|
||||
diff iii ttt
|
||||
}
|
||||
|
||||
# **********************************************************************
|
||||
# main
|
||||
|
||||
images="img_1771.jpg \
|
||||
kodak-dc210.jpg \
|
||||
dscf0176.jpg \
|
||||
sigma-d10-IMG10086.jpg \
|
||||
nikon-coolpix-990-DSCN1180.jpg \
|
||||
nikon-d70-dsc_0063.jpg \
|
||||
nikon-e950.jpg"
|
||||
|
||||
for i in $images; do cp -f ../test/images/$i ./; done
|
||||
|
||||
runTestCase 1 ./img_1771.jpg
|
||||
runTestCase 2 ./img_1771.jpg
|
||||
runTestCase 3 ./kodak-dc210.jpg
|
||||
runTestCase 4 ./img_1771.jpg
|
||||
runTestCase 5 ./img_1771.jpg
|
||||
runTestCase 6 ./kodak-dc210.jpg
|
||||
runTestCase 7 ./dscf0176.jpg
|
||||
runTestCase 8 ./sigma-d10-IMG10086.jpg
|
||||
runTestCase 9 ./nikon-coolpix-990-DSCN1180.jpg
|
||||
runTestCase 10 ./nikon-e950.jpg
|
||||
runTestCase 11 ./nikon-d70-dsc_0063.jpg
|
Loading…
Reference in New Issue