about summary refs log tree commit diff
path: root/test/pnmindex.test
blob: 5dc85b7091bcc4ccd0b082ab7faefe7614ab197e (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
#! /bin/sh
# This script tests: pnmindex
# Also requires:

pnmindex maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum

pnmindex -white -noquant maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum

pnmindex -black maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm maze.pbm | cksum

pnmindex -size 20 -accross=3 testgrid.pbm testgrid.pbm testgrid.pbm \
                             testgrid.pbm testgrid.pbm testgrid.pbm | cksum

echo "Test Invalid"

test_out=${tmpdir}/test_out
n=1

# define function
invcmd $1 > ${test_out} || \
  printf "Expected failure $n "
  test -s ${test_out} && echo "unexpected output" || echo "(no output)"
  rm -f ${test_out}
  n=$(($n +1)); }

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

invcmd "pnmindex -size -1 testgrid.pbm"
invcmd "pnmindex -size 0  testgrid.pbm"
invcmd "pnmindex -size    testgrid.pbm"
invcmd "pnmindex -across -1 testgrid.pbm"
invcmd "pnmindex -across 0  testgrid.pbm"
invcmd "pnmindex -across    testgrid.pbm"
invcmd "pnmindex -quant -1 testgrid.pbm"
invcmd "pnmindex -quant 0  testgrid.pbm"
invcmd "pnmindex testgrid.pbm /dev/null"