about summary refs log tree commit diff
path: root/test/stdin-pam2.test
blob: f47df6046e89126c7bcbdc44f7edde5458a1e364 (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
69
70
#! /bin/bash
# This script tests: pammasksharpen pammixmulti pamdice
# This script tests: pamlookup pamunlookup
# Also requires: pbmmake

tmpdir=${tmpdir:-/tmp}
out1=${tmpdir}/out1
out2=${tmpdir}/out2
out3=${tmpdir}/out3
out4=${tmpdir}/out4
small_pbm=${tmpdir}/small.pbm

pbmmake -g 3 3 > ${small_pbm}

for testprog in \
    pammasksharpen \
    pammixmulti
  do
  ${testprog} ${small_pbm}   ${small_pbm} > ${out1};   status1=$?
  ${testprog} ${small_pbm} < ${small_pbm} > ${out2};   status2=$?
  test -s ${out1};                                     status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog}": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out2}
done


  dicestem=${tmpdir}/dice

  testprog="pamdice -outstem=${dicestem}"
  ${testprog} ${small_pbm};   status1=$?
  cat ${dicestem}_*_*.pbm > ${out1}
  rm ${dicestem}_*_*.pbm
  ${testprog} < ${small_pbm}; status2=$?
  cat ${dicestem}_*_*.pbm > ${out2}
  rm ${dicestem}_*_*.pbm
  test -s ${out1};            status3=$?
  cmp -s ${out1} ${out2}
  echo pamdice: ${status1} ${status2} ${status3} $?
  # Do not use testprog, which contains a variable, in the above
  # Same for pamlookup, pamunlookup
  rm ${out1} ${out2}

lookup_ppm=${tmpdir}/lookup.ppm

cat > ${lookup_ppm} <<EOF
P3
2 1
2
0 0 0
0 1 2
EOF

  testprog="pamlookup -lookupfile=${lookup_ppm}"
  ${testprog}   ${small_pbm} > ${out1}; status1=$?
  ${testprog} < ${small_pbm} > ${out2}; status2=$?
  test -s ${out1};                      status3=$?
  cmp -s ${out1} ${out2}
  echo pamlookup": "${status1} ${status2} ${status3} $?
  rm ${out2}

  testprog="pamunlookup -lookupfile=${lookup_ppm}"
  ${testprog}   ${out1} > ${out3}; status1=$?
  ${testprog} < ${out1} > ${out4}; status2=$?
  test -s ${out1};                 status3=$?
  cmp -s ${out3} ${out4}
  echo pamunlookup": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out3} ${out4}

rm ${lookup_ppm} ${small_pbm}