1
1
#! /bin/bash
2
2
# This script tests: g3topbm pbmtog3
3
- # Also requires: pnmcrop pbmmake
3
+ # Also requires: pnmcrop pbmmake pbmpage pnmpad
4
4
5
5
tmpdir=${tmpdir:-/ tmp}
6
6
complete256_pbm=${tmpdir} /complete256.pbm
7
7
widew_pbm=${tmpdir} /widew.pbm
8
8
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"
9
13
10
14
pbmtog3 -nofixedwidth testgrid.pbm | \
11
15
g3topbm -width=14 | cmp -s - testgrid.pbm
@@ -19,6 +23,10 @@ pbmtog3 testgrid.pbm | \
19
23
g3topbm | pnmcrop -white -right -bottom | \
20
24
cmp -s - testgrid.pbm ; echo ${PIPESTATUS[@]} " :" $?
21
25
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
+
22
30
# works with gawk and mawk
23
31
# produce all possible 8-bit patterns
24
32
@@ -27,7 +35,7 @@ LC_ALL=C awk 'BEGIN { print "P4"; # header
27
35
for (i=0;i<256;++i) # raster
28
36
printf("%c",i) }' > ${complete256_pbm}
29
37
30
- pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \
38
+ pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \
31
39
cmp -s - ${complete256_pbm} ; echo ${PIPESTATUS[@]} " :" $?
32
40
33
41
pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \
@@ -54,8 +62,26 @@ pbmmake -b 5000 5 > ${wideb_pbm}
54
62
pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \
55
63
cmp -s - ${wideb_pbm} ; echo ${PIPESTATUS[@]} " :" $?
56
64
65
+
66
+
57
67
cat ${complete256_pbm} | cksum
58
68
cat ${wideb_pbm} | cksum
59
69
cat ${widew_pbm} | cksum
60
70
61
71
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
+
0 commit comments