about summary refs log tree commit diff
path: root/test/stdin-ppm3.test
blob: 605b535b6f899c9505f548ca6b4465a68992ae94 (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
76
77
#! /bin/sh
# This script tests: ppmtobmp bmptopnm
# This script tests: ppmtoilbm ilbmtoppm
# This script tests: ppmtoleaf leaftoppm
# This script tests: ppmtoneo neotoppm
# This script tests: ppmtopcx pcxtoppm
# This script tests: ppmtopi1 pi1toppm
# This script tests: ppmtopict picttoppm
# This script tests: ppmtopj pjtoppm
# This script tests: ppmtospu sputoppm
# This script tests: ppmtoxpm xpmtoppm
# Also requires: ppmmake

tmpdir=${tmpdir:-/tmp}
small_ppm=${tmpdir}/small.ppm
large_ppm=${tmpdir}/large.ppm
out1=${tmpdir}/out1
out2=${tmpdir}/out2
out3=${tmpdir}/out3
out4=${tmpdir}/out4

ppmmake -maxval 65535 rgb:00/00/00 8 3 > ${small_ppm}
ppmmake -maxval 7 rgb:00/00/00 320 200 > ${large_ppm}

for fmt in \
        bmp \
        ilbm \
        leaf \
        neo \
        pcx \
        pi1 \
        pict \
        pj \
        spu \
        xpm
  do
  testprog1="ppmto"${fmt}
  if [ ${fmt} = "bmp" ]
    then testprog2=${fmt}"topnm";
  else testprog2=${fmt}"toppm";
  fi

  if [ ${fmt} = "spu" ]
    then test_ppm=${large_ppm};
  else test_ppm=${small_ppm};
  fi

  ${testprog1} ${test_ppm} > ${out1};    status1=$?
  ${testprog1} < ${test_ppm} > ${out2};  status2=$?
  test -s ${out1};                       status3=$?
  if [ ${fmt} = "xpm" ]
    then
    sed -i '/^static char/s/static char .* = {/static char file/' \
	    ${out1} ${out2};
  fi
  cmp -s ${out1} ${out2}
  echo ${testprog1}": "${status1} ${status2} ${status3} $?
  rm ${out2}

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

rm ${small_ppm} ${large_ppm}

# ppmtopict width must be 8 or more

# ppmtospu sputoppm width=320 height=200 fixed

# Eyuvtoppm, Yuvtoppm width, height are mandatory

# Ppmtowinicon Winicontoppm legacy
# Winicontoppm max size 255 255