about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-03-24 16:52:59 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-03-24 16:52:59 +0000
commitfe9b6e1c06df26f93d24870dfd2781b3c88454ef (patch)
tree355ab984adc4f2cf6c3d8e9f6d6be35ad816690d /test
parent0e6163186419e2d1efbbda7cb00414cb40798b7d (diff)
downloadnetpbm-mirror-fe9b6e1c06df26f93d24870dfd2781b3c88454ef.tar.gz
netpbm-mirror-fe9b6e1c06df26f93d24870dfd2781b3c88454ef.tar.xz
netpbm-mirror-fe9b6e1c06df26f93d24870dfd2781b3c88454ef.zip
Add pamfind tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3579 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order1
-rw-r--r--test/all-in-place.ok1
-rwxr-xr-xtest/all-in-place.test1
-rw-r--r--test/pamfind.ok83
-rwxr-xr-xtest/pamfind.test32
5 files changed, 118 insertions, 0 deletions
diff --git a/test/Test-Order b/test/Test-Order
index 83fd8059..49eaeff2 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -33,6 +33,7 @@ ppmrough.test
 # Analyzer tests
 
 pamfile.test
+pamfind.test
 pamtable.test
 pgmhist.test
 ppmhist.test
diff --git a/test/all-in-place.ok b/test/all-in-place.ok
index 32fb573d..2df9f392 100644
--- a/test/all-in-place.ok
+++ b/test/all-in-place.ok
@@ -54,6 +54,7 @@ pamendian: ok
 pamenlarge: ok
 pamexec: ok
 pamfile: ok
+pamfind: ok
 pamfix: ok
 pamflip: ok
 pamfunc: ok
diff --git a/test/all-in-place.test b/test/all-in-place.test
index 2cb38677..6cf677ef 100755
--- a/test/all-in-place.test
+++ b/test/all-in-place.test
@@ -96,6 +96,7 @@ ordinary_testprogs="\
   pamenlarge \
   pamexec \
   pamfile \
+  pamfind \
   pamfix \
   pamflip \
   pamfunc \
diff --git a/test/pamfind.ok b/test/pamfind.ok
new file mode 100644
index 00000000..dc0f95ed
--- /dev/null
+++ b/test/pamfind.ok
@@ -0,0 +1,83 @@
+Test 1
+Locations containing tuple (43/43/43)/255:
+(6, 0)
+(6, 1)
+(7, 0)
+(7, 1)
+(19, 184)
+Locations containing tuple (210/57/41)/255:
+(44, 109)
+(96, 74)
+(96, 75)
+(100, 75)
+(100, 76)
+(100, 77)
+(100, 78)
+(101, 73)
+(101, 74)
+(101, 75)
+(101, 76)
+(101, 77)
+(101, 78)
+(102, 72)
+Test 2
+Locations containing tuple (1)/1:
+(0, 1)
+(0, 3)
+(0, 5)
+(0, 7)
+(0, 9)
+(0, 11)
+(0, 13)
+(2, 1)
+(2, 3)
+(2, 5)
+(2, 7)
+(2, 9)
+(2, 11)
+(2, 13)
+(4, 1)
+(4, 3)
+(4, 5)
+(4, 7)
+(4, 9)
+(4, 11)
+(4, 13)
+(6, 1)
+(6, 3)
+(6, 5)
+(6, 7)
+(6, 9)
+(6, 11)
+(6, 13)
+(8, 1)
+(8, 3)
+(8, 5)
+(8, 7)
+(8, 9)
+(8, 11)
+(8, 13)
+(10, 1)
+(10, 3)
+(10, 5)
+(10, 7)
+(10, 9)
+(10, 11)
+(10, 13)
+(12, 1)
+(12, 3)
+(12, 5)
+(12, 7)
+(12, 9)
+(12, 11)
+(12, 13)
+(14, 1)
+(14, 3)
+(14, 5)
+(14, 7)
+(14, 9)
+(14, 11)
+(14, 13)
+Test 3
+okay
+okay
diff --git a/test/pamfind.test b/test/pamfind.test
new file mode 100755
index 00000000..39cb1437
--- /dev/null
+++ b/test/pamfind.test
@@ -0,0 +1,32 @@
+#! /bin/bash
+# This script tests: pamfind
+# Also requires:
+
+tmpdir=${tmpdir:-/tmp}
+sorted0_res=${tmpdir}/pamfind_sorted0.res
+sorted1_res=${tmpdir}/pamfind_sorted1.res
+
+# Test 1
+echo Test 1
+pamfind -color=grey17     testimg.ppm 
+pamfind -target=210,57,41 testimg.ppm
+
+# Test 2
+echo Test 2
+pamfind -target=1 testgrid.pbm
+
+# Test 3
+# The two outputs should be disjoint
+echo Test 3
+pamfind -target=0 testgrid.pbm | sort > ${sorted0_res}
+pamfind -target=1 testgrid.pbm | sort > ${sorted1_res}
+comm -3 ${sorted0_res}  ${sorted1_res}  |
+  awk 'END {if (NR==226) print  "okay";
+            else printf("failure (line count=%d)\n", NR)}'
+comm -12 ${sorted0_res}  ${sorted1_res} | 
+  awk '{print}; END { if(NR == 0) print  "okay";
+            else printf("failure (line count=%d)\n", NR)}'
+
+rm ${sorted0_res} ${sorted1_res}
+
+