about summary refs log tree commit diff
path: root/test/pamslice-roundtrip.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-07-06 22:04:28 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-07-06 22:04:28 +0000
commit2a82091a45d67cadfc93148176a446ffd67021f6 (patch)
tree97de970b798441206a6294867eac8a8b9ea49b3b /test/pamslice-roundtrip.test
parent9ebbf59ad1a4272a182172f190908ea3f4d7227b (diff)
downloadnetpbm-mirror-2a82091a45d67cadfc93148176a446ffd67021f6.tar.gz
netpbm-mirror-2a82091a45d67cadfc93148176a446ffd67021f6.tar.xz
netpbm-mirror-2a82091a45d67cadfc93148176a446ffd67021f6.zip
Use red plane of testimg.ppm for test PGM input; rewrite file names which use tmpdir in the manner of symmetry.test; add some failure messages
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2225 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamslice-roundtrip.test')
-rwxr-xr-xtest/pamslice-roundtrip.test26
1 files changed, 16 insertions, 10 deletions
diff --git a/test/pamslice-roundtrip.test b/test/pamslice-roundtrip.test
index edec0d26..f17765d1 100755
--- a/test/pamslice-roundtrip.test
+++ b/test/pamslice-roundtrip.test
@@ -30,14 +30,18 @@
 # Add header and reconstruct ppm image.
 # Should print 914327477 4864
 
-pamcut 50 50 49 33 testimg.ppm > ${tmpdir}/test4933.ppm
+tmpdir=${tmpdir:-/tmp}
+
+test4933_ppm=${tmpdir}/test4933.ppm
+
+pamcut 50 50 49 33 testimg.ppm > ${test4933_ppm}
 
 (echo "P3"
  echo "49 33"
  echo "255"
  seq 0 32 | while read i;
      do
-     pamslice -row=$i ${tmpdir}/test4933.ppm | awk '{print $2, $3, $4}';
+     pamslice -row=$i ${test4933_ppm} | awk '{print $2, $3, $4}';
      done ) | pnmtopnm | cksum
 
 # Same as above test 2, but take cols instead of rows.
@@ -48,25 +52,27 @@ pamcut 50 50 49 33 testimg.ppm > ${tmpdir}/test4933.ppm
  echo "255"
  seq 0 48 | while read i;
      do
-     pamslice -col=$i ${tmpdir}/test4933.ppm | awk '{print $2, $3, $4}';
+     pamslice -col=$i ${test4933_ppm} | awk '{print $2, $3, $4}';
      done ) | pamflip -xy | cksum
 
 # Test 4.
 # Divide input image into two with pamdeinterlace and recombine.
 
-pamdeinterlace -takeodd ${tmpdir}/test4933.ppm > ${tmpdir}/testodd.ppm
-pamdeinterlace -takeeven ${tmpdir}/test4933.ppm > ${tmpdir}/testevn.ppm
+testeven_ppm=${tmpdir}/testeven.ppm
+testodd_ppm=${tmpdir}/testodd.ppm
+
+pamdeinterlace -takeodd ${test4933_ppm} > ${testodd_ppm}
+pamdeinterlace -takeeven ${test4933_ppm} > ${testeven_ppm}
 
 (echo "P3"
  echo "49 33"
  echo "255"
  seq 0 15 | while read i;
      do
-     pamslice -row=$i ${tmpdir}/testevn.ppm | awk '{print $2, $3, $4}';
-     pamslice -row=$i ${tmpdir}/testodd.ppm | awk '{print $2, $3, $4}';
+     pamslice -row=$i ${testeven_ppm} | awk '{print $2, $3, $4}';
+     pamslice -row=$i ${testodd_ppm} | awk '{print $2, $3, $4}';
      done
-     pamslice -row=16 ${tmpdir}/testevn.ppm | awk '{print $2, $3, $4}';
+     pamslice -row=16 ${testeven_ppm} | awk '{print $2, $3, $4}';
   ) | pnmtopnm | tee /tmp/z | cksum
 
-rm ${tmpdir}/test4933.ppm ${tmpdir}/testodd.ppm ${tmpdir}/testevn.ppm
-
+rm ${test4933_ppm} ${testodd_ppm} ${testeven_ppm}