about summary refs log tree commit diff
path: root/test/stdin-pbm1.test
blob: 4e99ba0b9c93bc6a235ba68560905089b4e45b8b (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
#! /bin/sh
# This script tests: pbmclean pbmlife pbmmask pbmminkowski pbmtoepsi
# This script tests: pbmtopsg3 pbmpscale pbmreduce pbmtopgm
# Also requires: pbmmake

# Tests whether output is unchanged when
# (1) input is a named file: pbm-command input-file
# (2) input is from stdin:   pbm-command < input-file

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

pbmmake -b 3 3 > ${small_pbm}

for testprog in \
        pbmclean \
        pbmlife \
        pbmmask \
        pbmminkowski \
        pbmtoepsi \
        pbmtopsg3 \
        "pbmpscale 1 " \
        "pbmreduce -threshold 2 " \
        "pbmtopgm 2 2 "
  do
  ${testprog} ${small_pbm} > ${out1};      status1=$?
  ${testprog} < ${small_pbm} > ${out2};    status2=$?
  test -s ${out1};                         status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog}": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out2}
  done

rm ${small_pbm}

# For Pbm converters not tested here see pbm-misc-converters.test

# These programs do not have a converter in the opposite direction:
# Brushtopbm
# Ddbugtopbm
# Thinkjettopbm (?)