about summary refs log tree commit diff
path: root/test/pamarith-multiple-input.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
commit23ce26f64c34e30951ad9ade2151552ed77e7357 (patch)
treed73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /test/pamarith-multiple-input.test
parent1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff)
downloadnetpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamarith-multiple-input.test')
-rwxr-xr-xtest/pamarith-multiple-input.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/pamarith-multiple-input.test b/test/pamarith-multiple-input.test
new file mode 100755
index 00000000..b9c09662
--- /dev/null
+++ b/test/pamarith-multiple-input.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# This script tests: pamarith
+# Also requires: pgmmake ppmpat pamfunc
+
+tmpdir=${tmpdir:-/tmp}
+
+input1_pgm=${tmpdir}/input1.pgm
+
+
+echo "Test 1"
+# Compare pamarith addition with pamfunc multiplication"
+
+pgmmake -maxval=99 0.01 16 11 > ${input1_pgm}
+
+add_command="pamarith -add "${input1_pgm}
+
+for i in 1 2 3 4 5 6 7 8 9 # for i in `seq 9`
+  do
+  echo ${i}":"
+  add_command=${add_command}" "${input1_pgm}
+  ${add_command} | cksum
+  pamfunc -multiplier=$((i+1)) ${input1_pgm} | cksum
+  done
+
+rm ${input1_pgm}
+
+g2_ppm=${tmpdir}/g2.ppm
+g3_ppm=${tmpdir}/g3.ppm
+
+# Produce test input images with ppmpat
+ppmpat -g2 -color=rgb:00/00/00,rgb:ff/ff/ff 17 21 > ${g2_ppm}
+ppmpat -g3 -color=rgb:ff/00/00,rgb:00/ff/00,rgb:00/00/ff 17 21 > ${g3_ppm}
+
+echo "Test 2"
+
+cat ${g2_ppm} | cksum
+echo "-or"
+pamarith -or   ${g2_ppm} ${g2_ppm} | cksum
+pamarith -or   ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+pamarith -or   ${g2_ppm} ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+echo "-and"
+pamarith -and  ${g2_ppm} ${g2_ppm} | cksum
+pamarith -and  ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+pamarith -and  ${g2_ppm} ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+echo "-xor"
+pamarith -xor  ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+pamarith -xor  ${g2_ppm} ${g2_ppm} ${g2_ppm} ${g2_ppm} ${g2_ppm} | cksum
+
+
+echo "Test 3"
+# Order does not matter
+
+for function in "-add" "-and" "-or" "-xor" "-nand" "-nor"
+  do
+  echo ${function}
+  pamarith ${function} ${g2_ppm} ${g2_ppm} ${g3_ppm} | cksum
+  pamarith ${function} ${g3_ppm} ${g2_ppm} ${g2_ppm} | cksum
+  pamarith ${function} ${g2_ppm} ${g3_ppm} ${g2_ppm} | cksum
+  done
+
+rm ${g2_ppm} ${g3_ppm}