about summary refs log tree commit diff
path: root/test/pamdice-roundtrip.test
blob: 4d3fba19eb1a1d68747192db2e1079902188242a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh
# This script tests: pamdice pamundice
# Also requires: pamfile

tmpdir=${tmpdir:-/tmp}
fname_stem=${tmpdir}/pamdice_part

mazesize=$(pamfile -size maze.pbm)
mw=$(echo ${mazesize} | cut -d " " -f 1)
mh=$(echo ${mazesize} | cut -d " " -f 2)

echo "Test 1.  Should print 281226646 481"

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.  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"

width=5
tiles=$(( (${mw}+${width}-1) / ${width} ))

pamdice maze.pbm -outstem=${fname_stem} -width=${width}
pamundice ${fname_stem}_%1d_%2a.pbm -across=${tiles} | cksum
rm ${fname_stem}_*_*.pbm


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
  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 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