about summary refs log tree commit diff
path: root/test/stdin-pam3.test
blob: 0225794248793e7540fa9293626cf2cfa11ca74b (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
71
72
73
74
75
#! /bin/sh
# This script tests: pamtoavs avstopam
# This script tests: pamtohdiff hdifftopam
# This script tests: pamtojpeg2k jpeg2ktopam
# This script tests: pamtopdbimg pdbimgtopam
# This script tests: pamtopfm pfmtopam
# This script tests: pamtopng pngtopam
# This script tests: pamtoqoi qoitopam
# This script tests: pamtosrf srftopam
# This script tests: pamtosvg svgtopam
# This script tests: pamtowinicon winicontopam
# This script tests: pamtotga tgatoppm
# This script tests: pamtoxvmini xvminitoppm
# This script tests: pamtofits fitstopnm
# This script tests: pamtogif giftopnm
# This script tests: pamtotiff tifftopnm
# Also requires: pgmmake

tmpdir=${tmpdir:-/tmp}
test_pgm=${tmpdir}/test.pgm
out1=${tmpdir}/out1
out2=${tmpdir}/out2
out3=${tmpdir}/out3
out4=${tmpdir}/out4

pgmmake -maxval 3 0.25 32 32 > ${test_pgm}

echo "Test.  Should print (command): 0 0 0 0"
echo "The following are exceptions: should print (command): 0 0 0 1"
echo "pamtotga, pamtotiff"
echo

for fmt in \
    avs \
    hdiff \
    jpeg2k \
    pdbimg \
    pfm \
    png \
    qoi \
    srf \
    svg \
    winicon \
    tga \
    xvmini \
    fits \
    gif \
    tiff
  do

  if [ ${fmt} = pdbimg ]
      then testprog1="pamtopdbimg -fixedtime";
      else testprog1="pamto"${fmt};
  fi

  case $fmt in
      "tga" | "xvmini")        testprog2=${fmt}"toppm";;
      "fits" | "gif" | "tiff") testprog2=${fmt}"topnm";;
      *) testprog2=${fmt}"topam";
  esac

  ${testprog1} ${test_pgm} > ${out1};      status1=$?
  ${testprog1} < ${test_pgm} > ${out2};    status2=$?
  test -s ${out1};                         status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog1}": "${status1} ${status2} ${status3} $?

  ${testprog2} ${out1} > ${out3};      status4=$?
  ${testprog2} < ${out1} > ${out4};    status5=$?
  test -s ${out3};                     status6=$?
  cmp -s ${out3} ${out4}
  echo ${testprog2}": "${status4} ${status5} ${status6} $?
  done

rm ${test_pgm}