about summary refs log tree commit diff
path: root/test/pamarith-compare-equal.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-12-06 03:35:30 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-12-06 03:35:30 +0000
commitb62eff9e0c76dcdab094bf9fe32355c543ea909f (patch)
treed9fcb02c5a8830d088657885f5e55340b29ae767 /test/pamarith-compare-equal.test
parent59bf40d2b1cfe85111b15ec05f8c124f657aefe2 (diff)
downloadnetpbm-mirror-b62eff9e0c76dcdab094bf9fe32355c543ea909f.tar.gz
netpbm-mirror-b62eff9e0c76dcdab094bf9fe32355c543ea909f.tar.xz
netpbm-mirror-b62eff9e0c76dcdab094bf9fe32355c543ea909f.zip
Add maze.pbm test image, update tests to use it
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4200 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamarith-compare-equal.test')
-rwxr-xr-xtest/pamarith-compare-equal.test45
1 files changed, 31 insertions, 14 deletions
diff --git a/test/pamarith-compare-equal.test b/test/pamarith-compare-equal.test
index 903ad538..e143a04c 100755
--- a/test/pamarith-compare-equal.test
+++ b/test/pamarith-compare-equal.test
@@ -1,20 +1,25 @@
 #! /bin/bash
 # This script tests: pamarith
-# Also requires: ppmpat pnminvert pbmmake pgmmake
+# Also requires: ppmpat pnminvert pamfile pbmmake pgmmake pamcut
 
 tmpdir=${tmpdir:-/tmp}
 input1_ppm=${tmpdir}/input1.ppm
+inputm_ppm=${tmpdir}/inputm.ppm
 input2_ppm=${tmpdir}/input2.ppm
 
 echo "Test 1"
 
 ppmpat -tartan -color=rgb:00/80/ff,rgb:80/ff/00,rgb:ff/00/80 \
    8 8  > ${input1_ppm}
+ppmpat -tartan -color=rgb:00/80/ff,rgb:80/ff/00,rgb:ff/00/80 \
+   -mesh 8 8  > ${inputm_ppm}
 ppmpat -tartan -color=rgb:80/ff/00,rgb:ff/00/80,rgb:00/80/ff \
    8 8  > ${input2_ppm}
 
 pamarith -compare -plain ${input1_ppm} ${input1_ppm} | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
+pamarith -compare -plain ${input1_ppm} ${inputm_ppm} | \
+  uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 pamarith -compare -plain ${input1_ppm} ${input2_ppm} | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 
@@ -22,54 +27,66 @@ echo "Test 2"
 
 pamarith -equal -plain ${input1_ppm} ${input1_ppm} | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
+pamarith -equal -plain ${input1_ppm} ${inputm_ppm} | \
+  uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 pamarith -equal -plain ${input1_ppm} ${input2_ppm} | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 
-rm ${input1_ppm} ${input2_ppm}
+rm ${input1_ppm} ${inputm_ppm} ${input2_ppm}
 
 echo "Test 3"
 
-pamarith -equal -plain testgrid.pbm testgrid.pbm  | \
+input3_pbm=${tmpdir}/input3.pbm
+pamcut maze.pbm -left=0 -right=0 -width=35 -height=33 > ${input3_pbm} 
+
+pamarith -equal -plain ${input3_pbm} ${input3_pbm}  | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
-pnminvert testgrid.pbm | pamarith -equal -plain testgrid.pbm - | \
+pnminvert ${input3_pbm} | pamarith -equal -plain ${input3_pbm} - | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
-pbmmake -w 14 16 | pamarith -equal -plain testgrid.pbm - | \
+
+xysize=$(pamfile -size testgrid.pbm)
+
+pbmmake -w ${xysize} | pamarith -equal -plain testgrid.pbm - | \
   awk '{printf("%s%c",$0, NR<3 || NR%2==0 ? "\n" : " ")}' | 
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
-pbmmake -b 14 16 | pamarith -equal -plain testgrid.pbm - | \
+pbmmake -b ${xysize} | pamarith -equal -plain testgrid.pbm - | \
   awk '{printf("%s%c",$0, NR<3 || NR%2==0 ? "\n" : " ")}' | 
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 
 echo "Test 4"
-  
-pamarith -compare -plain testgrid.pbm testgrid.pbm  | \
+
+
+pamarith -compare -plain ${input3_pbm} ${input3_pbm}  | \
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
+
 pnminvert testgrid.pbm | pamarith -compare -plain testgrid.pbm - | \
   awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | 
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
-pbmmake -w 14 16 | pamarith -compare -plain testgrid.pbm - | \
+pbmmake -w ${xysize} | pamarith -compare -plain testgrid.pbm - | \
   awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | 
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
-pbmmake -b 14 16 | pamarith -compare -plain testgrid.pbm - | \
+pbmmake -b ${xysize} | pamarith -compare -plain testgrid.pbm - | \
   awk '{printf("%s%c",$0, NR<4 || NR%2==1 ? "\n" : " ")}' | 
   uniq -c | sed -e 's/^ *//' -e 's/ /:/'
 
+rm ${input3_pbm}
 
 echo "Test 5"
 # -closeness
 
 input40_pgm=${tmpdir}/input40.pgm
 input50_pgm=${tmpdir}/input50.pgm
-equal_pgm=${tmpdir}/equal.pgm
 
 pgmmake -maxval=99 0.40 7 3 > ${input40_pgm}
 pgmmake -maxval=99 0.50 7 3 > ${input50_pgm}
 
-echo "Should produce 1285449498 54"
+echo "Should produce 1285449498 54 four times"
 pamarith -equal -plain ${input40_pgm} ${input40_pgm} | cksum
 pamarith -equal -plain -closeness=10.2 ${input40_pgm} ${input50_pgm} | cksum
 pamarith -equal -plain -closeness=11 ${input40_pgm} ${input50_pgm} | cksum
 pamarith -equal -plain -closeness=90 ${input40_pgm} ${input50_pgm} | cksum
-echo "Should produce 244506188 54"
+echo "Should produce 244506188 54 twice"
 pamarith -equal -plain ${input40_pgm} ${input50_pgm} | cksum
-pamarith -equal -plain -closeness=09   ${input40_pgm} ${input50_pgm} | cksum
+pamarith -equal -plain -closeness=09  ${input40_pgm} ${input50_pgm} | cksum
+
+rm ${input40_pgm} ${input50_pgm}
\ No newline at end of file