diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-21 23:52:53 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-21 23:52:53 +0000 |
commit | 2e7c05cecc62a84678138328074cafd8d740cad2 (patch) | |
tree | a32665b9db1449290f8ae3c1c86e473098fe8fd7 /test | |
parent | 6f46bc6bc1154208cc4b2122669b259f1259f25a (diff) | |
download | netpbm-mirror-2e7c05cecc62a84678138328074cafd8d740cad2.tar.gz netpbm-mirror-2e7c05cecc62a84678138328074cafd8d740cad2.tar.xz netpbm-mirror-2e7c05cecc62a84678138328074cafd8d740cad2.zip |
quantization down to 1 color is now allowed
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4773 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/pnmquantall.ok | 9 | ||||
-rwxr-xr-x | test/pnmquantall.test | 44 |
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} |