diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-01-14 19:05:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-01-14 19:05:28 +0000 |
commit | 49b0eb1a2a99dc82b81a9355bb7851db6423486a (patch) | |
tree | 23d3f3ff66a83e1968e648554a85c2f334302281 /test/pamcut.test | |
parent | 771e1f9460d70eb92f07716f88d9caa95f86527a (diff) | |
download | netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.tar.gz netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.tar.xz netpbm-mirror-49b0eb1a2a99dc82b81a9355bb7851db6423486a.zip |
Factor out 'test invalid' checks
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4837 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamcut.test')
-rwxr-xr-x | test/pamcut.test | 100 |
1 files changed, 18 insertions, 82 deletions
diff --git a/test/pamcut.test b/test/pamcut.test index 7cda5bce..7cbabf51 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -30,7 +30,7 @@ echo "Test 5. Should print 281226646 481 five times" mazesize=$(pamfile -size maze.pbm) width=$(echo ${mazesize} | cut -d " " -f 1) height=$(echo ${mazesize} | cut -d " " -f 2) - + pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 maze.pbm | \ cksum pamcut -top 0 -left 0 -bottom $((${height} -1)) -right $((${width} -1)) \ @@ -38,7 +38,7 @@ pamcut -top 0 -left 0 -bottom $((${height} -1)) -right $((${width} -1)) \ pamcut -top 0 -left 0 -bottom -1 -right -1 maze.pbm | cksum pamcut -top 0 -left 0 -width ${width} -height ${height} maze.pbm | cksum pamcut maze.pbm | cksum - + echo "Test 6. Should print 3412257956 129" pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum @@ -46,89 +46,25 @@ pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum echo "Test Invalid" -tmpdir=${tmpdir:-/tmp} -test_out=${tmpdir}/test_out - -echo 1>&2 -echo "Invalid command-line argument combinations." 1>&2 -echo "Error messages should appear below the line." 1>&2 -echo "-----------------------------------------------------------" 1>&2 +. ${srcdir}/test-invalid.inc # overspecification -pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ - printf "Expected failure 1 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ - printf "Expected failure 2 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 3 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 4 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 5 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ - printf "Expected failure 6 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -# excessive cropping -pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ - printf "Expected failure 7 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ - printf "Expected failure 8 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ - printf "Expected failure 9 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ - printf "Expected failure 6 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} +invCmd "pamcut -left=1 -right=1 -width=14 testgrid.pbm" +invCmd "pamcut -top=1 -bottom=1 -height=16 testgrid.pbm" +invCmd "pamcut -right=1 -cropright=1 testgrid.pbm" +invCmd "pamcut -top=1 -croptop=1 testgrid.pbm" +invCmd "pamcut -bottom=1 -cropbottom=1 testgrid.pbm" +invCmd "pamcut -left=1 -cropleft=1 testgrid.pbm" +invCmd "pamcut -cropleft=7 -cropright=8 testgrid.pbm" +invCmd "pamcut -left=7 -right=6 testgrid.pbm" +invCmd "pamcut -croptop=8 -cropbottom=8 testgrid.pbm" +invCmd "pamcut -top=10 -bottom=9 testgrid.pbm" # pad absent -pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ - printf "Expected failure 10 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ - printf "Expected failure 11 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} +invCmd "pamcut -cropleft=1 -width=14 testgrid.pbm" +invCmd "pamcut -croptop=1 -height=16 testgrid.pbm" # legacy style: insufficient number of positional parameters -pamcut 5 testimg.ppm > ${test_out} || \ - printf "Expected failure 12 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut 5 4 testimg.ppm > ${test_out} || \ - printf "Expected failure 13 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} - -pamcut 5 5 30 testimg.ppm > ${test_out} || \ - printf "Expected failure 14 " - test -s ${test_out} && echo "unexpected output" || echo "(no output)" - rm -f ${test_out} +invCmd "pamcut 5 testimg.ppm" +invCmd "pamcut 5 4 testimg.ppm" +invCmd "pamcut 5 5 30 testimg.ppm" |