diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-03-30 17:12:47 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-03-30 17:12:47 +0000 |
commit | 04afde0b11367018d95be801c543fdcf16420b5d (patch) | |
tree | 8c1ecbdf40aa57ff7fe47234708e3a2995d2b641 /test/symmetry.test | |
parent | fbf4dcdf76bf004ea45a762e8399268cc388ae19 (diff) | |
download | netpbm-mirror-04afde0b11367018d95be801c543fdcf16420b5d.tar.gz netpbm-mirror-04afde0b11367018d95be801c543fdcf16420b5d.tar.xz netpbm-mirror-04afde0b11367018d95be801c543fdcf16420b5d.zip |
Update to current Development release - 10.66.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2172 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/symmetry.test')
-rwxr-xr-x | test/symmetry.test | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/test/symmetry.test b/test/symmetry.test new file mode 100755 index 00000000..5fdb3918 --- /dev/null +++ b/test/symmetry.test @@ -0,0 +1,95 @@ +#! /bin/bash +# This script tests: pgmramp pamgauss pgmkernel pbmpscale +# Also requires: pamflip + + alias pgmramp="${PBM_TESTPREFIX}pgmramp" + alias pamgauss="${PBM_TESTPREFIX}pamgauss" + alias pgmkernel="${PBM_TESTPREFIX}pgmkernel" + alias pbmpscale="${PBM_TESTPREFIX}pbmpscale" + alias pamflip="${PBM_BINPREFIX}pamflip" + shopt -s expand_aliases + +# All tests print "ok" upon success, cksum results otherwise. +# The "$3>0" is a kludge for preventing false positives with empty files. + +# All test images are square and have the symmetries of the square (Dih4). +# The sole exception is ell.pgm which is a rectangle (Dih2, also called +# "Klein four-group".) + +# Example symmetric square PGM image: +# P2 +# 5 5 +# 6 +# 1 2 3 2 1 +# 2 4 5 4 2 +# 3 5 6 5 3 +# 2 4 5 4 2 +# 1 2 3 2 1 + +## Failure with this test indicates that a generator or editor which +## should produce symmetric output images isn't doing so. + +# Test 1. +pgmramp -rect 31 31 > ${tmpdir}/rect.pgm + +( for op in -null -tb -lr -r90 + do pamflip $op ${tmpdir}/rect.pgm | cksum + done ) | uniq -c | \ + awk '$1==4 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/rect.pgm + +# Test 2. +pgmramp -ell 63 63 > ${tmpdir}/circle.pgm + +( for op in -null -tb -lr -r90 + do pamflip $op ${tmpdir}/circle.pgm | cksum + done ) | uniq -c | \ + awk '$1==4 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/circle.pgm + +# Test 3. +pamgauss -sigma=0.1 -tupletype=GRAYSCALE 25 25 > ${tmpdir}/gauss.pam + +( for op in -null -tb -lr -r90 + do pamflip $op ${tmpdir}/gauss.pam | cksum + done ) | uniq -c | \ + awk '$1==4 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/gauss.pam + +# Test 4. +pgmkernel 15 15 > ${tmpdir}/kernel.pgm + +( for op in -null -tb -lr -r90 + do pamflip $op ${tmpdir}/kernel.pgm | cksum + done ) | uniq -c | \ + awk '$1==4 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/kernel.pgm + +# Test 5. +# Should print "ok" 7 times. +for size in `seq 1 7` +do +pbmmake -g 5 5 | pbmpscale $size > ${tmpdir}/pscale.pbm + +( for op in -null -tb -lr -r90 + do pamflip $op ${tmpdir}/pscale.pbm | cksum + done ) | uniq -c | \ + awk '$1==4 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/pscale.pbm +done + +# Test 6. +pgmramp -ell 101 33 > ${tmpdir}/ell.pgm + +( for op in -null -tb -lr + do pamflip $op ${tmpdir}/ell.pgm | cksum + done ) | uniq -c | \ + awk '$1==3 && $3>0 { print "ok"; exit }; { print }' + +rm ${tmpdir}/ell.pgm + |