diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /test/pambrighten.test | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-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/pambrighten.test')
-rwxr-xr-x | test/pambrighten.test | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/test/pambrighten.test b/test/pambrighten.test new file mode 100755 index 00000000..00e405dd --- /dev/null +++ b/test/pambrighten.test @@ -0,0 +1,99 @@ +#! /bin/sh +# This script tests: pambrighten +# Also requires: pgmramp + +tmpdir=${tmpdir:-/tmp} + +input_ppm=${tmpdir}/input.ppm + +cat > ${input_ppm} << EOF +P3 +8 1 +255 +0 0 0 0 0 100 0 100 0 0 100 100 100 0 0 100 0 100 100 100 0 100 100 100 +EOF + +# Test 1 + +echo "Test 1" +pambrighten -v 0 -plain ${input_ppm} +pambrighten -v +10 -plain ${input_ppm} +pambrighten -v -10 -plain ${input_ppm} +pambrighten -v +100 -plain ${input_ppm} +pambrighten -v +200 -plain ${input_ppm} +pambrighten -v -100 -plain ${input_ppm} + +echo "Test 2" +pambrighten -s -10 -plain ${input_ppm} +pambrighten -s -100 -plain ${input_ppm} + +echo "Test 3: Output invariant" +pambrighten -plain ${input_ppm} +pambrighten -v 0 -plain ${input_ppm} +pambrighten -s 0 -plain ${input_ppm} +pambrighten -s +10 -plain ${input_ppm} +pambrighten -s +100 -plain ${input_ppm} +pambrighten -s +200 -plain ${input_ppm} + +rm ${input_ppm} + +echo "Test 4: Should print 3990234518 268 six times" + +input_pgm=${tmpdir}/input.pgm + +pgmramp -lr 255 1 | tee ${input_pgm} | cksum +pambrighten -s -100 ${input_pgm} | cksum +pambrighten -s -10 ${input_pgm} | cksum +pambrighten -s +10 ${input_pgm} | cksum +pambrighten -s +100 ${input_pgm} | cksum +pambrighten -s +200 ${input_pgm} | cksum + +rm ${input_pgm} + + +# Test 2 +# These should all fail. + +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +echo "Test Error: Should print 1 six times" + +output_ppm=${tmpdir}/output.ppm + +pambrighten -v -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -s -120 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten 10 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? + + +echo "Test Error: Should print 99 followed by 1, four times" + +pambrighten -s 1.20 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -v 10.5 testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -v testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? +pambrighten -s testimg.ppm > ${output_ppm} +echo $? +test -s ${output_ppm} +echo $? + + +rm -f ${output_ppm} |