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

echo "Test 1: Should print 256 256"

# Default size is 256 256
ppmforge -night | pamfile -size

echo "Test 2: Should print 40 30"

# Width is adjusted if not even
# becomes 40 in this case
ppmforge -night -width=39 -height=30 | pamfile -size

echo "Test 3: Should print 90 90"

# Width is adjusted if smaller than height
# brought up to 90 in this case
ppmforge -night -width=80 -height=90 | pamfile -size

echo "Test Invalid"

tmpdir=${tmpdir:-/tmp}
test_out=${tmpdir}/test_out

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

ppmforge -night  -dimension=0  > ${test_out} || \
  printf "Expected failure 1"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge  -dimension=10  > ${test_out} || \
  printf "Expected failure 2"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge  -dimension=-1  > ${test_out} || \
  printf "Expected failure 3"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge -clouds -mesh=1.99    > ${test_out} || \
  printf "Expected failure 4"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge -clouds -power=0      > ${test_out} || \
  printf "Expected failure 5"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge         -ice=-1       > ${test_out} || \
  printf "Expected failure 6"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}

ppmforge         -glaciers=-1  > ${test_out} || \
  printf "Expected failure 7"
  test -s ${test_out}; echo " "$?
  rm -f ${test_out}