about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pnmquantall.ok9
-rwxr-xr-xtest/pnmquantall.test44
2 files changed, 42 insertions, 11 deletions
diff --git a/test/pnmquantall.ok b/test/pnmquantall.ok
index 5885d370..c7563d88 100644
--- a/test/pnmquantall.ok
+++ b/test/pnmquantall.ok
@@ -1,7 +1,14 @@
+Test 1.
 2373957371 33838
 3892560659 33838
 1383839923 33838
-1
+color count 20: success
+Test 2.
+452076937 33838
+452076937 33838
+452076937 33838
+color count 1: success
+Test Invalid
 Expected failure 1
 Expected failure 1.rm
 Expected failure 2
diff --git a/test/pnmquantall.test b/test/pnmquantall.test
index f047e856..7910d0fc 100755
--- a/test/pnmquantall.test
+++ b/test/pnmquantall.test
@@ -12,21 +12,45 @@ rose_red=${tmpdir}/rose.red
 rose_grn=${tmpdir}/rose.grn
 rose_blu=${tmpdir}/rose.blu
 
-pnmquantall 20 ${rose_red} ${rose_grn} ${rose_blu}
+cp ${rose_red} ${rose_red}.1
+cp ${rose_grn} ${rose_grn}.1
+cp ${rose_blu} ${rose_blu}.1
 
-for i in ${rose_red} ${rose_grn} ${rose_blu}
+echo "Test 1."
+
+pnmquantall 20 ${rose_red}.1 ${rose_grn}.1 ${rose_blu}.1
+
+for i in ${rose_red}.1 ${rose_grn}.1 ${rose_blu}.1
 do
 cat $i | cksum
 done
 
-# Should print 1
+pamcat ${rose_red}.1 ${rose_grn}.1 ${rose_blu}.1 -tb | \
+    pgmhist -m |\
+    awk '$2>0 {s++};
+         END { printf("color count %u: %s\n", s,
+                 (s==20) ? "success" : "failure") }'
 
-pamcat ${rose_red} ${rose_grn} ${rose_blu} -tb | \
-    pgmhist -m | awk '$2>0 {s++}; END { print (s<=20) }'
+rm ${rose_red}.1 ${rose_grn}.1 ${rose_blu}.1
 
+echo "Test 2."
 
-tmpdir=${tmpdir:-/tmp}
-rose_out=${tmpdir}/rose_out
+pnmquantall -ext .2 1 ${rose_red} ${rose_grn} ${rose_blu}
+
+for i in ${rose_red}.2 ${rose_grn}.2 ${rose_blu}.2
+do
+cat $i | cksum
+done
+
+pamcat ${rose_red}.2 ${rose_grn}.2 ${rose_blu}.2 -tb | \
+    pgmhist -m |\
+    awk '$2>0 {s++};
+         END { printf("color count %u: %s\n", s,
+                 (s==1) ? "success" : "failure") }'
+
+rm ${rose_red}.2 ${rose_grn}.2 ${rose_blu}.2
+
+echo "Test Invalid"
 
 echo 1>&2
 echo "Invalid command-line argument combinations." 1>&2
@@ -37,11 +61,11 @@ pnmquantall -ext xx 0 ${rose_red} ${rose_grn} ${rose_blu} || \
    echo "Expected failure 1"
 rm ${rose_red}xx ${rose_grn}xx ${rose_blu}xx || \
    echo "Expected failure 1.rm"
-pnmquantall -ext xx 1 ${rose_red} ${rose_grn} ${rose_blu} || \
+pnmquantall -ext yy ${rose_red} ${rose_grn} ${rose_blu} || \
    echo "Expected failure 2"
-rm ${rose_red}xx ${rose_grn}xx ${rose_blu}xx || \
+rm ${rose_red}yy ${rose_grn}yy ${rose_blu}yy || \
    echo "Expected failure 2.rm"
-pnmquantall -ext xx 2 || \
+pnmquantall -ext zz 2 || \
    echo "Expected failure 3"
 
 rm ${rose_red} ${rose_grn} ${rose_blu} ${rose_ppm}