diff options
Diffstat (limited to 'test/pnmquant.test')
-rwxr-xr-x | test/pnmquant.test | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/test/pnmquant.test b/test/pnmquant.test index 3a2ef906..4baff9a8 100755 --- a/test/pnmquant.test +++ b/test/pnmquant.test @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # This script tests: pnmquant # Also requires: ppmhist @@ -7,30 +7,30 @@ echo "Test 1" # Count colors in output image. pnmquant 256 testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' + awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' pnmquant -center 256 testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' + awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' pnmquant -spreadbrightness 256 testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' + awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' pnmquant -spreadluminosity 128 testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' + awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' pnmquant -floyd -randomseed=0 128 testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' + awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' pnmquant 64 -meanpixel testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}' + awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}' pnmquant 16 -meancolor testimg.ppm | ppmhist | \ - awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}' + awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}' pnmquant 2 testgrid.pbm | ppmhist | \ - awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }' - + awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }' + echo "Test Invalid" echo 1>&2 @@ -42,20 +42,41 @@ tmpdir=${tmpdir:-/tmp} test_out=${tmpdir}/test_out pnmquant 0 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + printf "Expected failure 1 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant testimg.ppm > ${test_out} || \ - echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + printf "Expected failure 2 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant 10.5 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + printf "Expected failure 3 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + printf "Expected failure 4 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant -center -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? + printf "Expected failure 5 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + printf "Expected failure 6 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? -pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \ - echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? + printf "Expected failure 7 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} -rm ${test_out} +pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \ + printf "Expected failure 8 " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} |