From b927b100ae3a818a927daf59f05a9fd463ffff20 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 7 Nov 2021 16:37:01 +0000 Subject: New tests git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4178 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/atk-roundtrip.ok | 6 ++++++ test/atk-roundtrip.test | 19 +++++++++++++++++-- test/g3-roundtrip.ok | 9 +++++++++ test/g3-roundtrip.test | 30 ++++++++++++++++++++++++++++-- test/macp-roundtrip.ok | 9 +++++++++ test/macp-roundtrip.test | 37 ++++++++++++++++++++++++++++++------- test/mgr-roundtrip.ok | 6 ++++++ test/mgr-roundtrip.test | 14 +++++++++++--- 8 files changed, 116 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/atk-roundtrip.ok b/test/atk-roundtrip.ok index 845be5fb..c037f1b9 100644 --- a/test/atk-roundtrip.ok +++ b/test/atk-roundtrip.ok @@ -1 +1,7 @@ +Test 1. Should print 2425386270 41 2425386270 41 +Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice +241513515 125013 +241513515 125013 +2146497872 1000013 +2146497872 1000013 diff --git a/test/atk-roundtrip.test b/test/atk-roundtrip.test index 6db3df6d..856efa4f 100755 --- a/test/atk-roundtrip.test +++ b/test/atk-roundtrip.test @@ -1,7 +1,22 @@ #! /bin/bash # This script tests: pbmtoatk atktopbm -# Also requires: +# Also requires: pbmmake +echo "Test 1. Should print 2425386270 41" +# cksum of testgrid.pbm -# Should print 2425386270 41, cksum of testgrid.pbm pbmtoatk testgrid.pbm | atktopbm | cksum + +tmpdir=${tmpdir:-/tmp} +maxwidth_pbm=${tmpdir}/maxwidth.pbm +maxheight_pbm=${tmpdir}/maxheight.pbm + +echo "Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice" + +pbmmake -g 1000000 1 | tee ${maxwidth_pbm} | cksum +pbmtoatk ${maxwidth_pbm} | atktopbm | cksum + +pbmmake -b 1 1000000 | tee ${maxheight_pbm} | cksum +pbmtoatk ${maxheight_pbm} | atktopbm | cksum + +rm ${maxwidth_pbm} ${maxheight_pbm} diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok index 603c9457..7140cc8b 100644 --- a/test/g3-roundtrip.ok +++ b/test/g3-roundtrip.ok @@ -1,6 +1,9 @@ +Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times 0 0 0 : 0 0 0 0 : 0 0 0 0 0 : 0 +Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times +then 1777627284 265, 2985378006 3135, 3651878552 3135 0 0 0 : 0 0 0 0 : 0 0 0 0 0 : 0 @@ -11,3 +14,9 @@ 1777627284 265 2985378006 3135 3651878552 3135 +Test 3. Should print 0 0 0 : 0 twice +then 356688157 17399694 twice +0 0 0 : 0 +0 0 0 : 0 +356688157 17399694 +356688157 17399694 diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test index d18e4466..603e6408 100755 --- a/test/g3-roundtrip.test +++ b/test/g3-roundtrip.test @@ -1,11 +1,15 @@ #! /bin/bash # This script tests: g3topbm pbmtog3 -# Also requires: pnmcrop pbmmake +# Also requires: pnmcrop pbmmake pbmpage pnmpad tmpdir=${tmpdir:-/tmp} complete256_pbm=${tmpdir}/complete256.pbm widew_pbm=${tmpdir}/widew.pbm wideb_pbm=${tmpdir}/wideb.pbm +page_pbm=${tmpdir}/page.pbm +pagemax_pbm=${tmpdir}/pagemax.pbm + +echo "Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times" pbmtog3 -nofixedwidth testgrid.pbm | \ g3topbm -width=14 | cmp -s - testgrid.pbm @@ -19,6 +23,10 @@ pbmtog3 testgrid.pbm | \ g3topbm | pnmcrop -white -right -bottom | \ cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} ":" $? + +echo "Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times" +echo "then 1777627284 265, 2985378006 3135, 3651878552 3135" + # works with gawk and mawk # produce all possible 8-bit patterns @@ -27,7 +35,7 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header for (i=0;i<256;++i) # raster printf("%c",i) }' > ${complete256_pbm} -pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ +pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \ cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $? pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \ @@ -54,8 +62,26 @@ pbmmake -b 5000 5 > ${wideb_pbm} pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \ cmp -s - ${wideb_pbm} ; echo ${PIPESTATUS[@]} ":" $? + + cat ${complete256_pbm} | cksum cat ${wideb_pbm} | cksum cat ${widew_pbm} | cksum rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm} + + +echo "Test 3. Should print 0 0 0 : 0 twice" +echo "then 356688157 17399694 twice" + +pbmpage 3 -a4 | pamenlarge 2 > ${page_pbm} +pbmtog3 -nofixedwidth ${page_pbm} | g3topbm | \ + cmp -s - ${page_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +pnmpad -width=1000 -height=1400 ${page_pbm} > ${pagemax_pbm} +pbmtog3 -nofixedwidth ${pagemax_pbm} | g3topbm | \ + cmp -s - ${pagemax_pbm} ; echo ${PIPESTATUS[@]} ":" $? + +cat ${page_pbm} | cksum +cat ${pagemax_pbm} | cksum + diff --git a/test/macp-roundtrip.ok b/test/macp-roundtrip.ok index 9ff9d249..0c49cdf2 100644 --- a/test/macp-roundtrip.ok +++ b/test/macp-roundtrip.ok @@ -1,5 +1,14 @@ +Test 1. Should produce 2425386270 41 twice 2425386270 41 2425386270 41 +Test 2. Should produce 2329957971 51851 2329957971 51851 +Test 3. Should produce 2907103393 5086 three times 2907103393 5086 2907103393 5086 +2907103393 5086 +Test 4. Should produce 3432623660 51851 four times +3432623660 51851 +3432623660 51851 +3432623660 51851 +3432623660 51851 diff --git a/test/macp-roundtrip.test b/test/macp-roundtrip.test index 4774a2c2..94e67f35 100755 --- a/test/macp-roundtrip.test +++ b/test/macp-roundtrip.test @@ -2,12 +2,17 @@ # This script tests: pbmtomacp macptopbm # Also requires: pnmcrop pbmpage pbmupc pnmpad +PATH=/home/netpbm/p4151/bin/:$PATH + tmpdir=${tmpdir:-/tmp} -temp1_pbm=${tmpdir}/temp1.ppm -temp2_pbm=${tmpdir}/temp2.ppm +temp1_pbm=${tmpdir}/temp1.pbm +temp2_pbm=${tmpdir}/temp2.pbm +tempupc_pbm=${tmpdir}/tempupc.pbm +temp3_pbm=${tmpdir}/temp3.pbm +temp3_macp=${tmpdir}/temp3.macp +echo "Test 1. Should produce 2425386270 41 twice" -# Test 1. Should produce 2425386270 41 twice # Because Macpaint files are fixed size (576 x 720 pixels) # pbmtomacp automatically adds padding when input is smaller. @@ -16,16 +21,34 @@ pbmtomacp testgrid.pbm | macptopbm | tee ${temp1_pbm} | \ pbmtomacp ${temp1_pbm} | macptopbm | pnmcrop | cksum +rm ${temp1_pbm} + -#Test 2. Should produce 2329957971 51851 +echo "Test 2. Should produce 2329957971 51851" pbmpage 1 | pbmtomacp | macptopbm | cksum -#Test 3. Should produce 2907103393 5086 twice -pbmupc 0 12345 67890 | pnmpad -black -t 44 -b 20 -l 100 -r 251 | pbmtomacp | macptopbm | \ +echo "Test 3. Should produce 2907103393 5086 three times" +pbmupc 0 12345 67890 | tee ${tempupc_pbm} | pnmpad -black -t 44 -b 20 -l 100 -r 251 | \ + pbmtomacp | macptopbm | \ tee ${temp2_pbm} | \ pnmcrop | pnmcrop | cksum +pnmpad -black -t 44 -l 100 ${tempupc_pbm} | \ + pbmtomacp| macptopbm | pnmcrop -white | pnmcrop | cksum + pbmtomacp ${temp2_pbm} | macptopbm | pnmcrop | pnmcrop | cksum -rm ${temp1_pbm} ${temp2_pbm} +rm ${temp2_pbm} ${tempupc_pbm} + + +echo "Test 4. Should produce 3432623660 51851 four times" +pbmmake -b 576 720 | tee ${temp3_pbm} | cksum + +pbmtomacp ${temp3_pbm} | tee ${temp3_macp} | macptopbm | cksum + +pbmtomacp -norle ${temp3_pbm} | macptopbm | cksum + +( head -c 128 /dev/zero ; cat ${temp3_macp} ) | macptopbm -extraskip 128 | cksum + +rm ${temp3_pbm} ${temp3_macp} diff --git a/test/mgr-roundtrip.ok b/test/mgr-roundtrip.ok index 845be5fb..0263a8c6 100644 --- a/test/mgr-roundtrip.ok +++ b/test/mgr-roundtrip.ok @@ -1 +1,7 @@ +Test 1. Should print 2425386270 41 2425386270 41 +Test 2. Should print 429369764 1034, 448060073 4105 twice each +429369764 1034 +429369764 1034 +448060073 4105 +448060073 4105 diff --git a/test/mgr-roundtrip.test b/test/mgr-roundtrip.test index 252ae996..7ca2ff3d 100755 --- a/test/mgr-roundtrip.test +++ b/test/mgr-roundtrip.test @@ -1,7 +1,15 @@ #! /bin/bash # This script tests: pbmtomgr mgrtopbm -# Also requires: +# Also requires: pbmmake - -# Should print 2425386270 41, cksum of testgrid.pbm +echo "Test 1. Should print 2425386270 41" pbmtomgr testgrid.pbm | mgrtopbm | cksum + +echo "Test 2. Should print 429369764 1034, 448060073 4105 twice each" +# Maximum width and height allowed + +pbmmake -g 4095 2 | cksum +pbmmake -g 4095 2 | pbmtomgr | mgrtopbm | cksum +pbmmake -g 1 4095 | cksum +pbmmake -g 1 4095 | pbmtomgr | mgrtopbm | cksum + -- cgit 1.4.1