From b62eff9e0c76dcdab094bf9fe32355c543ea909f Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 6 Dec 2021 03:35:30 +0000 Subject: Add maze.pbm test image, update tests to use it git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4200 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/pamdice-roundtrip.test | 52 ++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'test/pamdice-roundtrip.test') diff --git a/test/pamdice-roundtrip.test b/test/pamdice-roundtrip.test index c5ccde66..b387a8ea 100755 --- a/test/pamdice-roundtrip.test +++ b/test/pamdice-roundtrip.test @@ -1,38 +1,60 @@ #! /bin/bash # This script tests: pamdice pamundice -# Also requires: - +# Also requires: pamfile tmpdir=${tmpdir:-/tmp} fname_stem=${tmpdir}/pamdice_part -echo test 1 +mazesize=$(pamfile -size maze.pbm) +mw=$(echo ${mazesize} | cut -d" " -f1) +mh=$(echo ${mazesize} | cut -d" " -f2) + +echo "Test 1. Should print 281226646 481" -pamdice testgrid.pbm -outstem=${fname_stem} +pamdice maze.pbm -outstem=${fname_stem} pamundice ${fname_stem}_%1d_%1a.pbm -down=1 -across=1 | cksum rm ${fname_stem}_0_0.pbm -echo test 2 +echo "Test 2. Should print 281226646 481" + +width=10 +tiles=$(( (${mw}+${width}-1) / ${width} )) + + +pamdice maze.pbm -outstem=${fname_stem} -width=${width} +pamundice ${fname_stem}_%1d_%1a.pbm -across=${tiles} | cksum +rm ${fname_stem}_*_*.pbm + +echo "Test 3. Should print 281226646 481" -pamdice testgrid.pbm -outstem=${fname_stem} -width=3 -pamundice ${fname_stem}_%1d_%1a.pbm -across=5 | cksum -rm ${fname_stem}_0_?.pbm +width=5 +tiles=$(( (${mw}+${width}-1) / ${width} )) -echo test 3 +pamdice maze.pbm -outstem=${fname_stem} -width=${width} +pamundice ${fname_stem}_%1d_%2a.pbm -across=${tiles} | cksum +rm ${fname_stem}_*_*.pbm -pamdice testgrid.pbm -outstem=${fname_stem} -height=4 -pamundice ${fname_stem}_%1d_%1a.pbm -down=4 | cksum -rm ${fname_stem}_?_0.pbm -for flags in "" "-hoverlap=0" "-hoverlap=2" "-voverlap=0" "-voverlap=2" +echo "Test 4. Should print 281226646 481" + +height=10 +tiles=$(( (${mh}+${height}-1) / ${height} )) + +pamdice maze.pbm -outstem=${fname_stem} -height=${height} +pamundice ${fname_stem}_%1d_%1a.pbm -down=${tiles} | cksum +#rm ${fname_stem}_*_*.pbm + +echo "Test 5. Should print 1926073387 101484 five times" + +for option in "" "-hoverlap=0" "-hoverlap=2" "-voverlap=0" "-voverlap=2" do - echo test 4.${flags} pamdice testimg.ppm -outstem=${fname_stem} -width=50 -height=40 pamundice ${fname_stem}_%1d_%1a.ppm -down=4 -across=5 | cksum rm ${fname_stem}_?_?.ppm done -echo test 5 +echo "Test 6. Should print 1926073387 101484" + pamdice testimg.ppm -outstem=${fname_stem} -width=20 -height=10 ls ${fname_stem}*.ppm | pamundice -listfile=- -across=12 -down=15 | cksum rm ${fname_stem}_??_??.ppm \ No newline at end of file -- cgit 1.4.1