Skip to content

Commit 2416378

Browse files
author
giraffedata
committed
New tests
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@4178 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent 5015e64 commit 2416378

8 files changed

+116
-14
lines changed

test/atk-roundtrip.ok

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
Test 1. Should print 2425386270 41
12
2425386270 41
3+
Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice
4+
241513515 125013
5+
241513515 125013
6+
2146497872 1000013
7+
2146497872 1000013

test/atk-roundtrip.test

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
#! /bin/bash
22
# This script tests: pbmtoatk atktopbm
3-
# Also requires:
3+
# Also requires: pbmmake
44

5+
echo "Test 1. Should print 2425386270 41"
6+
# cksum of testgrid.pbm
57

6-
# Should print 2425386270 41, cksum of testgrid.pbm
78
pbmtoatk testgrid.pbm | atktopbm | cksum
9+
10+
tmpdir=${tmpdir:-/tmp}
11+
maxwidth_pbm=${tmpdir}/maxwidth.pbm
12+
maxheight_pbm=${tmpdir}/maxheight.pbm
13+
14+
echo "Test 2. Should print 1824220442 125013 twice, then 2146497872 1000013 twice"
15+
16+
pbmmake -g 1000000 1 | tee ${maxwidth_pbm} | cksum
17+
pbmtoatk ${maxwidth_pbm} | atktopbm | cksum
18+
19+
pbmmake -b 1 1000000 | tee ${maxheight_pbm} | cksum
20+
pbmtoatk ${maxheight_pbm} | atktopbm | cksum
21+
22+
rm ${maxwidth_pbm} ${maxheight_pbm}

test/g3-roundtrip.ok

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times
12
0 0 0 : 0
23
0 0 0 : 0
34
0 0 0 0 : 0
5+
Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times
6+
then 1777627284 265, 2985378006 3135, 3651878552 3135
47
0 0 0 : 0
58
0 0 0 : 0
69
0 0 0 0 : 0
@@ -11,3 +14,9 @@
1114
1777627284 265
1215
2985378006 3135
1316
3651878552 3135
17+
Test 3. Should print 0 0 0 : 0 twice
18+
then 356688157 17399694 twice
19+
0 0 0 : 0
20+
0 0 0 : 0
21+
356688157 17399694
22+
356688157 17399694

test/g3-roundtrip.test

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#! /bin/bash
22
# This script tests: g3topbm pbmtog3
3-
# Also requires: pnmcrop pbmmake
3+
# Also requires: pnmcrop pbmmake pbmpage pnmpad
44

55
tmpdir=${tmpdir:-/tmp}
66
complete256_pbm=${tmpdir}/complete256.pbm
77
widew_pbm=${tmpdir}/widew.pbm
88
wideb_pbm=${tmpdir}/wideb.pbm
9+
page_pbm=${tmpdir}/page.pbm
10+
pagemax_pbm=${tmpdir}/pagemax.pbm
11+
12+
echo "Test 1. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total three times"
913

1014
pbmtog3 -nofixedwidth testgrid.pbm | \
1115
g3topbm -width=14 | cmp -s - testgrid.pbm
@@ -19,6 +23,10 @@ pbmtog3 testgrid.pbm | \
1923
g3topbm | pnmcrop -white -right -bottom | \
2024
cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} ":" $?
2125

26+
27+
echo "Test 2. Should print 0 0 0 : 0 or 0 0 0 0 : 0 total seven times"
28+
echo "then 1777627284 265, 2985378006 3135, 3651878552 3135"
29+
2230
# works with gawk and mawk
2331
# produce all possible 8-bit patterns
2432

@@ -27,7 +35,7 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header
2735
for (i=0;i<256;++i) # raster
2836
printf("%c",i) }' > ${complete256_pbm}
2937

30-
pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \
38+
pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \
3139
cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} ":" $?
3240

3341
pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \
@@ -54,8 +62,26 @@ pbmmake -b 5000 5 > ${wideb_pbm}
5462
pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \
5563
cmp -s - ${wideb_pbm} ; echo ${PIPESTATUS[@]} ":" $?
5664

65+
66+
5767
cat ${complete256_pbm} | cksum
5868
cat ${wideb_pbm} | cksum
5969
cat ${widew_pbm} | cksum
6070

6171
rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm}
72+
73+
74+
echo "Test 3. Should print 0 0 0 : 0 twice"
75+
echo "then 356688157 17399694 twice"
76+
77+
pbmpage 3 -a4 | pamenlarge 2 > ${page_pbm}
78+
pbmtog3 -nofixedwidth ${page_pbm} | g3topbm | \
79+
cmp -s - ${page_pbm} ; echo ${PIPESTATUS[@]} ":" $?
80+
81+
pnmpad -width=1000 -height=1400 ${page_pbm} > ${pagemax_pbm}
82+
pbmtog3 -nofixedwidth ${pagemax_pbm} | g3topbm | \
83+
cmp -s - ${pagemax_pbm} ; echo ${PIPESTATUS[@]} ":" $?
84+
85+
cat ${page_pbm} | cksum
86+
cat ${pagemax_pbm} | cksum
87+

test/macp-roundtrip.ok

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Test 1. Should produce 2425386270 41 twice
12
2425386270 41
23
2425386270 41
4+
Test 2. Should produce 2329957971 51851
35
2329957971 51851
6+
Test 3. Should produce 2907103393 5086 three times
47
2907103393 5086
58
2907103393 5086
9+
2907103393 5086
10+
Test 4. Should produce 3432623660 51851 four times
11+
3432623660 51851
12+
3432623660 51851
13+
3432623660 51851
14+
3432623660 51851

test/macp-roundtrip.test

+30-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
# This script tests: pbmtomacp macptopbm
33
# Also requires: pnmcrop pbmpage pbmupc pnmpad
44

5+
PATH=/home/netpbm/p4151/bin/:$PATH
6+
57
tmpdir=${tmpdir:-/tmp}
6-
temp1_pbm=${tmpdir}/temp1.ppm
7-
temp2_pbm=${tmpdir}/temp2.ppm
8+
temp1_pbm=${tmpdir}/temp1.pbm
9+
temp2_pbm=${tmpdir}/temp2.pbm
10+
tempupc_pbm=${tmpdir}/tempupc.pbm
11+
temp3_pbm=${tmpdir}/temp3.pbm
12+
temp3_macp=${tmpdir}/temp3.macp
813

14+
echo "Test 1. Should produce 2425386270 41 twice"
915

10-
# Test 1. Should produce 2425386270 41 twice
1116
# Because Macpaint files are fixed size (576 x 720 pixels)
1217
# pbmtomacp automatically adds padding when input is smaller.
1318

@@ -16,16 +21,34 @@ pbmtomacp testgrid.pbm | macptopbm | tee ${temp1_pbm} | \
1621

1722
pbmtomacp ${temp1_pbm} | macptopbm | pnmcrop | cksum
1823

24+
rm ${temp1_pbm}
25+
1926

20-
#Test 2. Should produce 2329957971 51851
27+
echo "Test 2. Should produce 2329957971 51851"
2128
pbmpage 1 | pbmtomacp | macptopbm | cksum
2229

2330

24-
#Test 3. Should produce 2907103393 5086 twice
25-
pbmupc 0 12345 67890 | pnmpad -black -t 44 -b 20 -l 100 -r 251 | pbmtomacp | macptopbm | \
31+
echo "Test 3. Should produce 2907103393 5086 three times"
32+
pbmupc 0 12345 67890 | tee ${tempupc_pbm} | pnmpad -black -t 44 -b 20 -l 100 -r 251 | \
33+
pbmtomacp | macptopbm | \
2634
tee ${temp2_pbm} | \
2735
pnmcrop | pnmcrop | cksum
2836

37+
pnmpad -black -t 44 -l 100 ${tempupc_pbm} | \
38+
pbmtomacp| macptopbm | pnmcrop -white | pnmcrop | cksum
39+
2940
pbmtomacp ${temp2_pbm} | macptopbm | pnmcrop | pnmcrop | cksum
3041

31-
rm ${temp1_pbm} ${temp2_pbm}
42+
rm ${temp2_pbm} ${tempupc_pbm}
43+
44+
45+
echo "Test 4. Should produce 3432623660 51851 four times"
46+
pbmmake -b 576 720 | tee ${temp3_pbm} | cksum
47+
48+
pbmtomacp ${temp3_pbm} | tee ${temp3_macp} | macptopbm | cksum
49+
50+
pbmtomacp -norle ${temp3_pbm} | macptopbm | cksum
51+
52+
( head -c 128 /dev/zero ; cat ${temp3_macp} ) | macptopbm -extraskip 128 | cksum
53+
54+
rm ${temp3_pbm} ${temp3_macp}

test/mgr-roundtrip.ok

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
Test 1. Should print 2425386270 41
12
2425386270 41
3+
Test 2. Should print 429369764 1034, 448060073 4105 twice each
4+
429369764 1034
5+
429369764 1034
6+
448060073 4105
7+
448060073 4105

test/mgr-roundtrip.test

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
#! /bin/bash
22
# This script tests: pbmtomgr mgrtopbm
3-
# Also requires:
3+
# Also requires: pbmmake
44

5-
6-
# Should print 2425386270 41, cksum of testgrid.pbm
5+
echo "Test 1. Should print 2425386270 41"
76
pbmtomgr testgrid.pbm | mgrtopbm | cksum
7+
8+
echo "Test 2. Should print 429369764 1034, 448060073 4105 twice each"
9+
# Maximum width and height allowed
10+
11+
pbmmake -g 4095 2 | cksum
12+
pbmmake -g 4095 2 | pbmtomgr | mgrtopbm | cksum
13+
pbmmake -g 1 4095 | cksum
14+
pbmmake -g 1 4095 | pbmtomgr | mgrtopbm | cksum
15+

0 commit comments

Comments
 (0)