about summary refs log tree commit diff
path: root/test/pamundice.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/pamundice.test')
-rwxr-xr-xtest/pamundice.test42
1 files changed, 22 insertions, 20 deletions
diff --git a/test/pamundice.test b/test/pamundice.test
index 1e3dd31b..14b43dfb 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 # This script tests: pamundice
 # Also requires: pamfile pgmmake pnmtile pnmcat
 
@@ -7,8 +7,8 @@ fname_stem=${tmpdir}/part
 
 echo "Test 1.  Should print 2096818803 2818 twice"
 
-for ((x=0; x<3; ++x))
-  do for ((y=0; y<5; ++y))
+for x in 0 1 2
+  do for y in 0 1 2 3 4
     do
     pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm
     done
@@ -23,7 +23,7 @@ echo "Test 2.  Should print 2096818803 2818 twice"
 
 tempfile=${tmpdir}/temp
 
-for ((y=0; y<5; ++y))
+for y in 0 1 2 3 4
   do
   pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y"
   done
@@ -33,7 +33,7 @@ rm ${tempfile}_[01234]
 
 # Note: the following 2 are valid.  There should not be warning messages.
 
-for ((x=0; x<3; ++x))
+for x in 0 1 2
   do
   pamundice -down=5 ${fname_stem}"_%1d_"$x.pgm > ${tempfile}"_"$x
   done
@@ -45,15 +45,15 @@ rm ${fname_stem}_?_?.pgm
 
 echo "Test 3.  Should print 2096818803 2818 twice"
 
-for ((x=0; x<2; ++x))
-  do for ((y=0; y<5; ++y))
+for x in 0 1
+  do for y in 0 1 2 3 4
     do
     pgmmake "."$(( x* 25 + y )) 12 17 > ${fname_stem}_${y}_${x}.pgm
     done
   done
 
-for ((x=2; x<3; ++x))
-  do for ((y=0; y<5; ++y))
+for x in 2
+  do for y in 0 1 2 3 4
     do
     pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm
     done
@@ -64,15 +64,15 @@ pamundice -across=3 -down=5 \
 
 rm ${fname_stem}_?_?.pgm
 
-for ((x=0; x<3; ++x))
-  do for ((y=0; y<4; ++y))
+for x in 0 1 2
+  do for y in 0 1 2 3
     do
     pgmmake "."$(( x* 25 + y )) 11 18 > ${fname_stem}_${y}_${x}.pgm
     done
   done
 
-for ((x=0; x<3; ++x))
-  do for ((y=4; y<5; ++y))
+for x in 0 1 2
+  do for y in 4
     do
     pgmmake "."$(( x* 25 + y )) 11 17 > ${fname_stem}_${y}_${x}.pgm
     done
@@ -88,17 +88,17 @@ rm ${fname_stem}_?_?.pgm
 echo "Test 4.  Should print 2434390296 4436 four times"
 
 msize=$(pamfile -size maze.pbm)
-mw=$(echo ${msize} | cut -d" " -f1)
-mh=$(echo ${msize} | cut -d" " -f2)
+mw=$(echo ${msize} | cut -d " " -f 1)
+mh=$(echo ${msize} | cut -d " " -f 2)
 
 pnmtile $((${mw} * 2)) $((${mh} * 5)) maze.pbm | cksum
 
-for x in `seq 0 1`
-  do for y in `seq 0 4`
+for x in 0 1
+  do for y in 0 1 2 3 4
     do cp maze.pbm ${fname_stem}_${y}_${x}.pbm; done
   done
 
-for (( i=0 ; i<=9; ++i))
+for i in 0 1 2 3 4 5 6 7 8 9
   do
   echo maze.pbm
   done | pamundice -down=5 -across=2 -listfile=- | cksum
@@ -184,8 +184,10 @@ pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \
   rm -f ${test_out}
 
 # corrupt listfile : file names do not exist
-seq 10 | sed -e 's/^/::::::/' -e 's/$/::::::/' | \
-  pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
+for i in 0 1 2 3 4 5 6 7 8 9
+  do
+  mktemp -u XXXXXXXXXX.${i} || echo ":::::::::::"${i}":::::::::::"
+  done | pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
   echo -n "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}