about summary refs log tree commit diff
path: root/test/pamdice.test
blob: 3199fd4abffc85c7440c891db1e9fbf8f5fece84 (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
61
62
63
64
65
66
67
68
#! /bin/bash
# This script tests: pamdice
# Also requires: pbmmake

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

# Test 1.
echo "Test 1."

pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
ls ${fname_stem}*.pbm | while read file
  do
  cat ${file} | tr '\n'  '@' ; echo 
  done | sort | uniq -c | sed 's/^ *//'

rm ${fname_stem}*.pbm

# Test 1.
echo "Test 2."

pbmmake -g 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
ls ${fname_stem}*.pbm | while read file
  do
  cat ${file} | tr '\n'  '@' ; echo 
  done

rm ${fname_stem}*.pbm


# Test Invalid.
echo "Test Invalid"

echo 1>&2
echo "Invalid command-line argument combinations." 1>&2
echo "Error messages should appear below the line." 1>&2
echo "-----------------------------------------------------------" 1>&2

# No input file
pamdice -width=10 -height=10  -outstem=${fname_stem} /dev/null || \
echo "Expected failure 1"

# No -outstem
pamdice -width=10 -height=10 testgrid.pbm || \
echo "Expected failure 2"

# -width=0
pamdice -width=0 -height=10 -outstem=${fname_stem} testgrid.pbm || \
echo "Expected failure 3"

# -height=0
pamdice -width=10 -height=0 -outstem=${fname_stem} testgrid.pbm || \
echo "Expected failure 4"

# -hoverlap larger than width
pamdice -width=10 -height=10 -hoverlap=11 \
  -outstem=${fname_stem} testgrid.pbm || \
echo "Expected failure 5"

# -voverlap larger than height
pamdice -width=10 -height=10 -voverlap=11 \
  -outstem=${fname_stem} testgrid.pbm || \
echo "Expected failure 6"


# Ensure that no output files are produced by the above
ls ${fname_stem}* || \
echo "Expected failure (output files)"