Skip to content

Commit 91dca27

Browse files
author
giraffedata
committed
use aliases to make tests easier to read and modify; add white line to top in Pnmshear test
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@2098 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent 1523c07 commit 91dca27

File tree

90 files changed

+749
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+749
-350
lines changed

test/411toppm.test

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
# This script tests: 411toppm
33
# Also requires:
44

5+
alias 411toppm="${PBM_TESTPREFIX}411toppm"
6+
shopt -s expand_aliases
7+
58
# Test 1. should produce: 240376509 9229
69
# The above value is what 411toppm has been always producing.
710
# 411toppm's author Steve Allen says he was not able to obtain accurate
811
# specifications for the .411 format. Technically, the above can change.
912
#
1013
# See comment at head of source file 411toppm.c.
1114

12-
head -c 4608 /dev/zero | ${PBM_TESTPREFIX}411toppm -quiet | cksum
15+
head -c 4608 /dev/zero | 411toppm -quiet | cksum

test/atk-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pbmtoatk atktopbm
33
# Also requires:
44

5+
alias atktopbm="${PBM_TESTPREFIX}atktopbm"
6+
alias pbmtoatk="${PBM_TESTPREFIX}pbmtoatk"
7+
shopt -s expand_aliases
8+
59
# Should print 2425386270 41, cksum of testgrid.pbm
6-
${PBM_TESTPREFIX}pbmtoatk testgrid.pbm | ${PBM_TESTPREFIX}atktopbm | cksum
10+
pbmtoatk testgrid.pbm | atktopbm | cksum

test/avs-roundtrip.test

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# This script tests: pamtoavs avstopam
33
# Also requires: pamtopnm
44

5+
alias avstopam="${PBM_TESTPREFIX}avstopam"
6+
alias pamtoavs="${PBM_TESTPREFIX}pamtoavs"
7+
alias pamtopnm="${PBM_BINPREFIX}pamtopnm"
8+
shopt -s expand_aliases
9+
510
# Should produce 1926073387 101484, cksum of testimg.ppm
6-
${PBM_TESTPREFIX}pamtoavs testimg.ppm | \
7-
${PBM_TESTPREFIX}avstopam | ${PBM_BINPREFIX}pamtopnm | cksum
11+
pamtoavs testimg.ppm | \
12+
avstopam | pamtopnm | cksum

test/bmp-roundtrip.test

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: bmptopnm ppmtobmp
33
# Also requires:
44

5-
${PBM_TESTPREFIX}ppmtobmp testimg.ppm | ${PBM_TESTPREFIX}bmptopnm | cksum
6-
${PBM_TESTPREFIX}ppmtobmp testgrid.pbm | ${PBM_TESTPREFIX}bmptopnm | cksum
5+
alias bmptopnm="${PBM_TESTPREFIX}bmptopnm"
6+
alias ppmtobmp="${PBM_TESTPREFIX}ppmtobmp"
7+
shopt -s expand_aliases
8+
9+
ppmtobmp testimg.ppm | bmptopnm | cksum
10+
ppmtobmp testgrid.pbm | bmptopnm | cksum

test/cmuw-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pbmtocmuwm cmuwmtopbm
33
# Also requires:
44

5+
alias cmuwmtopbm="${PBM_TESTPREFIX}cmuwmtopbm"
6+
alias pbmtocmuwm="${PBM_TESTPREFIX}pbmtocmuwm"
7+
shopt -s expand_aliases
8+
59
# Should print 2425386270 41, cksum of testgrid.pbm
6-
${PBM_TESTPREFIX}pbmtocmuwm testgrid.pbm | ${PBM_TESTPREFIX}cmuwmtopbm | cksum
10+
pbmtocmuwm testgrid.pbm | cmuwmtopbm | cksum

test/cut-paste-roundtrip.test

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pamcut pnmpaste
33
# Also requires:
44

5-
${PBM_TESTPREFIX}pamcut 50 40 100 70 testimg.ppm | \
6-
${PBM_TESTPREFIX}pnmpaste -replace - 50 40 testimg.ppm | cksum
5+
alias pamcut="${PBM_TESTPREFIX}pamcut"
6+
alias pnmpaste="${PBM_TESTPREFIX}pnmpaste"
7+
shopt -s expand_aliases
8+
9+
pamcut 50 40 100 70 testimg.ppm | \
10+
pnmpaste -replace - 50 40 testimg.ppm | cksum

test/eyuvtoppm.test

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# This script tests: eyuvtoppm
33
# Also requires:
44

5+
alias eyuvtoppm="${PBM_TESTPREFIX}eyuvtoppm"
6+
shopt -s expand_aliases
7+
58
# Should produce 1719878124 253455
69

7-
head -c 126720 /dev/zero | ${PBM_TESTPREFIX}eyuvtoppm -quiet | cksum
10+
head -c 126720 /dev/zero | eyuvtoppm -quiet | cksum

test/facesaver-roundtrip.test

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
# This script tests: pgmtofs fstopgm
33
# Also requires: ppmtopgm
44

5+
alias fstopgm="${PBM_TESTPREFIX}fstopgm"
6+
alias pgmtofs="${PBM_TESTPREFIX}pgmtofs"
7+
alias ppmtopgm="${PBM_BINPREFIX}ppmtopgm"
8+
shopt -s expand_aliases
9+
510
# Should produce 2871603838 33838, cksum of testimg.pgm
611

7-
${PBM_BINPREFIX}ppmtopgm testimg.ppm | \
8-
${PBM_TESTPREFIX}pgmtofs | ${PBM_TESTPREFIX}fstopgm | cksum
12+
ppmtopgm testimg.ppm | \
13+
pgmtofs | fstopgm | cksum

test/fits-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pamtofits fitstopnm
33
# Also requires:
44

5+
alias fitstopnm="${PBM_TESTPREFIX}fitstopnm"
6+
alias pamtofits="${PBM_TESTPREFIX}pamtofits"
7+
shopt -s expand_aliases
8+
59
# Should produce 1926073387 101484, cksum of testimg.ppm
6-
${PBM_TESTPREFIX}pamtofits testimg.ppm | ${PBM_TESTPREFIX}fitstopnm | cksum
10+
pamtofits testimg.ppm | fitstopnm | cksum

test/g3-roundtrip.test

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
# This script tests: g3topbm pbmtog3
33
# Also requires: pnmcrop
44

5-
${PBM_TESTPREFIX}pbmtog3 -nofixedwidth testgrid.pbm | \
6-
${PBM_TESTPREFIX}g3topbm -width=14 | cmp -s - testgrid.pbm
5+
alias g3topbm="${PBM_TESTPREFIX}g3topbm"
6+
alias pbmtog3="${PBM_TESTPREFIX}pbmtog3"
7+
alias pnmcrop="${PBM_BINPREFIX}pnmcrop"
8+
shopt -s expand_aliases
9+
10+
pbmtog3 -nofixedwidth testgrid.pbm | \
11+
g3topbm -width=14 | cmp -s - testgrid.pbm
712
echo $?
813

9-
${PBM_TESTPREFIX}pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \
10-
${PBM_TESTPREFIX}g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm
14+
pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \
15+
g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm
1116
echo $?
1217

13-
${PBM_TESTPREFIX}pbmtog3 testgrid.pbm | \
14-
${PBM_TESTPREFIX}g3topbm | ${PBM_BINPREFIX}pnmcrop -white -right -bottom | \
18+
pbmtog3 testgrid.pbm | \
19+
g3topbm | pnmcrop -white -right -bottom | \
1520
cmp -s - testgrid.pbm ; echo $?

test/gem-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pbmtogem gemtopbm
33
# Also requires: gemtopnm
44

5+
alias gemtopbm="${PBM_TESTPREFIX}gemtopbm"
6+
alias pbmtogem="${PBM_TESTPREFIX}pbmtogem"
7+
shopt -s expand_aliases
8+
59
# Should print 2425386270 41, cksum of testgrid.pbm
6-
${PBM_TESTPREFIX}pbmtogem testgrid.pbm | ${PBM_TESTPREFIX}gemtopbm | cksum
10+
pbmtogem testgrid.pbm | gemtopbm | cksum

test/gif-quant-roundtrip.test

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
# This script tests: giftopnm pamtogif pnmquant
33
# Also requires: pnmcolormap pnmremap
44

5+
alias giftopnm="${PBM_TESTPREFIX}giftopnm"
6+
alias pamtogif="${PBM_TESTPREFIX}pamtogif"
7+
alias pnmquant="${PBM_TESTPREFIX}pnmquant"
8+
shopt -s expand_aliases
9+
510
# Should print 0
611

712
colors=15 # any value between 2 - 256 works
813

9-
${PBM_TESTPREFIX}pnmquant $colors testimg.ppm > ${tmpdir}/quant.ppm &&
10-
${PBM_TESTPREFIX}pamtogif ${tmpdir}/quant.ppm | ${PBM_TESTPREFIX}giftopnm | \
14+
pnmquant $colors testimg.ppm > ${tmpdir}/quant.ppm &&
15+
pamtogif ${tmpdir}/quant.ppm | giftopnm | \
1116
cmp -s - ${tmpdir}/quant.ppm > /dev/null
1217
echo $?
1318

test/gif-roundtrip.test

+21-13
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,46 @@
22
# This script tests: giftopnm pamtogif
33
# Also requires: ppmtopgm ppmtorgb3 rgb3toppm pbmmake
44

5+
alias giftopnm="${PBM_TESTPREFIX}giftopnm"
6+
alias pamtogif="${PBM_TESTPREFIX}pamtogif"
7+
alias pbmmake="${PBM_BINPREFIX}pbmmake"
8+
alias ppmtopgm="${PBM_BINPREFIX}ppmtopgm"
9+
alias ppmtorgb3="${PBM_BINPREFIX}ppmtorgb3"
10+
alias rgb3toppm="${PBM_BINPREFIX}rgb3toppm"
11+
shopt -s expand_aliases
12+
513
# Test 1. Should produce 2871603838 33838
614
# which is the result of ppmtopgm testimg.ppm | cksum
715

8-
${PBM_BINPREFIX}ppmtopgm testimg.ppm | \
9-
${PBM_TESTPREFIX}pamtogif | ${PBM_TESTPREFIX}giftopnm | cksum
16+
ppmtopgm testimg.ppm | \
17+
pamtogif | giftopnm | cksum
1018

1119
# Test 2. Break up input image into three monochrome planes,
1220
# maxval 255. Transform each plane to gif and back to pgm.
1321
# Reassemble the planes. Result should be identical to input.
1422
# Should print 1926073387 101484
1523

1624
cp testimg.ppm ${tmpdir} &&
17-
${PBM_BINPREFIX}ppmtorgb3 ${tmpdir}/testimg.ppm &&
18-
${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.red | \
19-
${PBM_TESTPREFIX}giftopnm > ${tmpdir}/out.red &&
20-
${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.grn |
21-
${PBM_TESTPREFIX}giftopnm > ${tmpdir}/out.grn &&
22-
${PBM_TESTPREFIX}pamtogif ${tmpdir}/testimg.blu | \
23-
${PBM_TESTPREFIX}giftopnm | \
24-
${PBM_BINPREFIX}rgb3toppm ${tmpdir}/testimg.red ${tmpdir}/testimg.grn - | \
25+
ppmtorgb3 ${tmpdir}/testimg.ppm &&
26+
pamtogif ${tmpdir}/testimg.red | \
27+
giftopnm > ${tmpdir}/out.red &&
28+
pamtogif ${tmpdir}/testimg.grn |
29+
giftopnm > ${tmpdir}/out.grn &&
30+
pamtogif ${tmpdir}/testimg.blu | \
31+
giftopnm | \
32+
rgb3toppm ${tmpdir}/testimg.red ${tmpdir}/testimg.grn - | \
2533
cksum
2634

2735
rm ${tmpdir}/testimg.{ppm,red,grn,blu} ${tmpdir}/out.{red,grn}
2836

2937
# Test 3. Should produce 2425386270 41
30-
${PBM_TESTPREFIX}pamtogif testgrid.pbm | ${PBM_TESTPREFIX}giftopnm | cksum
38+
pamtogif testgrid.pbm | giftopnm | cksum
3139

3240
# Test 4.
3341
# In this gif file the code length changes after the last image data.
3442
# Image data: 3 bits, end code 4 bits.
3543
# Should produce P1 4 1 0 1 0 1
3644

37-
${PBM_BINPREFIX}pbmmake -g 4 1 | \
38-
${PBM_TESTPREFIX}pamtogif | ${PBM_TESTPREFIX}giftopnm -plain | \
45+
pbmmake -g 4 1 | \
46+
pamtogif | giftopnm -plain | \
3947
tr '\n' ' '

test/hdiff-roundtrip.test

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: hdifftopam pamtohdiff
33
# Also requires:
44

5-
${PBM_TESTPREFIX}pamtohdiff testimg.ppm | \
6-
${PBM_TESTPREFIX}hdifftopam -pnm | cksum
5+
alias hdifftopam="${PBM_TESTPREFIX}hdifftopam"
6+
alias pamtohdiff="${PBM_TESTPREFIX}pamtohdiff"
7+
shopt -s expand_aliases
8+
9+
pamtohdiff testimg.ppm | \
10+
hdifftopam -pnm | cksum

test/leaf-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: ppmtoleaf leaftoppm
33
# Also requires:
44

5+
alias leaftoppm="${PBM_TESTPREFIX}leaftoppm"
6+
alias ppmtoleaf="${PBM_TESTPREFIX}ppmtoleaf"
7+
shopt -s expand_aliases
8+
59
# Should produce 1926073387 101484, cksum of testimg.ppm
6-
${PBM_TESTPREFIX}ppmtoleaf testimg.ppm | ${PBM_TESTPREFIX}leaftoppm | cksum
10+
ppmtoleaf testimg.ppm | leaftoppm | cksum

test/mgr-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pbmtomgr mgrtopbm
33
# Also requires:
44

5+
alias mgrtopbm="${PBM_TESTPREFIX}mgrtopbm"
6+
alias pbmtomgr="${PBM_TESTPREFIX}pbmtomgr"
7+
shopt -s expand_aliases
8+
59
# Should print 2425386270 41, cksum of testgrid.pbm
6-
${PBM_TESTPREFIX}pbmtomgr testgrid.pbm | ${PBM_TESTPREFIX}mgrtopbm | cksum
10+
pbmtomgr testgrid.pbm | mgrtopbm | cksum

test/mrf-roundtrip.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
# This script tests: pbmtomrf mrftopbm
33
# Also requires:
44

5+
alias mrftopbm="${PBM_TESTPREFIX}mrftopbm"
6+
alias pbmtomrf="${PBM_TESTPREFIX}pbmtomrf"
7+
shopt -s expand_aliases
8+
59
# Should print 2425386270 41, cksum of testgrid.pbm
6-
${PBM_TESTPREFIX}pbmtomrf testgrid.pbm | ${PBM_TESTPREFIX}mrftopbm | cksum
10+
pbmtomrf testgrid.pbm | mrftopbm | cksum

test/pad-crop-roundtrip.test

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
# This script tests: pnmcrop pnmmargin
33
# Also requires: pnmpad
44

5-
${PBM_TESTPREFIX}pnmmargin -white 10 testimg.ppm | \
6-
${PBM_TESTPREFIX}pnmcrop | cksum
7-
${PBM_TESTPREFIX}pnmmargin -white 10 testgrid.pbm | \
8-
${PBM_TESTPREFIX}pnmcrop | cksum
5+
alias pnmcrop="${PBM_TESTPREFIX}pnmcrop"
6+
alias pnmmargin="${PBM_TESTPREFIX}pnmmargin"
7+
shopt -s expand_aliases
8+
9+
pnmmargin -white 10 testimg.ppm | \
10+
pnmcrop | cksum
11+
pnmmargin -white 10 testgrid.pbm | \
12+
pnmcrop | cksum

test/pamchannel.test

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# This script tests: pamchannel
33
# Also requires: pamtopnm
44

5+
alias pamchannel="${PBM_TESTPREFIX}pamchannel"
6+
alias pamtopnm="${PBM_BINPREFIX}pamtopnm"
7+
shopt -s expand_aliases
8+
59

610
# Extract planes one by one.
711
# Convert output to pgm to make it identical to ppmtorgb3 output.
@@ -16,17 +20,17 @@
1620
# Test 1. red channel
1721
# Should produce 1571496937 33838
1822

19-
${PBM_TESTPREFIX}pamchannel -infile testimg.ppm 0 | \
20-
${PBM_BINPREFIX}pamtopnm --assume | cksum
23+
pamchannel -infile testimg.ppm 0 | \
24+
pamtopnm --assume | cksum
2125

2226
# Test 2. green channel
2327
# Should produce 394856971 33838
2428

25-
${PBM_TESTPREFIX}pamchannel -infile testimg.ppm 1 | \
26-
${PBM_BINPREFIX}pamtopnm --assume | cksum
29+
pamchannel -infile testimg.ppm 1 | \
30+
pamtopnm --assume | cksum
2731

2832
# Test 3. blue channel
2933
# Should produce 3164158573 33838
3034

31-
${PBM_TESTPREFIX}pamchannel -infile testimg.ppm 2 | \
32-
${PBM_BINPREFIX}pamtopnm --assume | cksum
35+
pamchannel -infile testimg.ppm 2 | \
36+
pamtopnm --assume | cksum

test/pamcut.test

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
# This script tests: pamcut pbmmake
33
# Also requires:
44

5+
alias pamcut="${PBM_TESTPREFIX}pamcut"
6+
alias pbmmake="${PBM_TESTPREFIX}pbmmake"
7+
shopt -s expand_aliases
8+
59
# Test 1. Should print 2958909756 124815
6-
${PBM_TESTPREFIX}pamcut -top 0 -left 0 -width 260 -height 160 \
10+
pamcut -top 0 -left 0 -width 260 -height 160 \
711
-pad testimg.ppm | cksum
812
# Test 2. Should print 1550940962 10933
9-
${PBM_TESTPREFIX}pamcut -top 200 -left 120 -width 40 -height 40 \
13+
pamcut -top 200 -left 120 -width 40 -height 40 \
1014
-pad testimg.ppm | cksum
1115
# Test 3. Should print 708474423 14
12-
${PBM_TESTPREFIX}pamcut -top 5 -left 5 -bottom 5 -right 5 testimg.ppm | cksum
16+
pamcut -top 5 -left 5 -bottom 5 -right 5 testimg.ppm | cksum
1317
# Test 3. Should print 3412257956 129
14-
${PBM_TESTPREFIX}pbmmake -g 50 50 | ${PBM_TESTPREFIX}pamcut 5 5 30 30 | cksum
18+
pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum

test/pamdepth-roundtrip.test

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
# This script tests: pamdepth pgmtopbm
33
# Also requires:
44

5+
alias pamdepth="${PBM_TESTPREFIX}pamdepth"
6+
alias pgmtopbm="${PBM_TESTPREFIX}pgmtopbm"
7+
shopt -s expand_aliases
8+
59
for i in 300 500 1023 4095 5000 16383 65535
610
do
7-
${PBM_TESTPREFIX}pamdepth $i testimg.ppm | \
8-
${PBM_TESTPREFIX}pamdepth 255 | cksum
11+
pamdepth $i testimg.ppm | \
12+
pamdepth 255 | cksum
913
done
1014

11-
${PBM_TESTPREFIX}pamdepth 255 testgrid.pbm | ${PBM_TESTPREFIX}pamdepth 1 | \
12-
${PBM_TESTPREFIX}pgmtopbm -th -val=0.5 | cksum
15+
pamdepth 255 testgrid.pbm | pamdepth 1 | \
16+
pgmtopbm -th -val=0.5 | cksum

test/pamdice-roundtrip.test

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
# This script tests: pamdice pamundice
33
# Also requires:
44

5-
${PBM_TESTPREFIX}pamdice testimg.ppm -outstem=${tmpdir}/a -width=50 -height=40
6-
${PBM_TESTPREFIX}pamundice ${tmpdir}/a_%1d_%1a.ppm -down=4 -across=5 | cksum
5+
alias pamdice="${PBM_TESTPREFIX}pamdice"
6+
alias pamundice="${PBM_TESTPREFIX}pamundice"
7+
shopt -s expand_aliases
8+
9+
pamdice testimg.ppm -outstem=${tmpdir}/a -width=50 -height=40
10+
pamundice ${tmpdir}/a_%1d_%1a.ppm -down=4 -across=5 | cksum
711

812
rm ${tmpdir}/a_?_?.ppm
913

0 commit comments

Comments
 (0)