about summary refs log tree commit diff
path: root/test/pdb-roundtrip.test
blob: 32d7aa8790806017d92f03d4af653a880b5a68f5 (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
#! /bin/bash
# This script tests: pamtopdbimg pdbimgtopam
# Also requires: pnmtile pgmramp pamtopnm pamdepth

tmpdir=${tmpdir:-/tmp}
tiled_pbm=${tmpdir}/tiled.pbm
ellipse_pgm=${tmpdir}/ellipse.pgm


# Test 1. Should produce 2224198737 25671
# 3 times 
echo pbm grid
for flag in "-compressed" "-maybecompressed" "-uncompressed"
   do
   pamtopdbimg ${flag} testgrid.pbm | pdbimgtopam | cksum
   done


# Test 2. Should produce 0 0 0
# 4 times 
echo pbm tiled
pnmtile 160 160 testgrid.pbm > ${tiled_pbm}
for flag in "" "-compressed" "-maybecompressed" "-uncompressed"
  do
  pamtopdbimg ${flag} ${tiled_pbm} | pdbimgtopam | pamtopnm | \
    cmp -s - ${tiled_pbm}
  echo ${PIPESTATUS[@]} ":" $?
  done
rm ${tiled_pbm}


# Test 3. Should produce 0 0 0
# 4 times
echo pgm ellipse
pgmramp -ellipse 160 160 -maxval=3 > ${ellipse_pgm}
for flag in "" "-compressed" "-maybecompressed" "-uncompressed"
    do
    pamtopdbimg ${flag} ${ellipse_pgm} | pdbimgtopam | \
      pamtopnm | pamdepth 3 | cmp -s - ${ellipse_pgm}
    echo ${PIPESTATUS[@]} ":" $?
    done
rm ${ellipse_pgm}


# Test 3. Should produce 0 0 0
# 3 times 
echo pgm ellipse -4depth
pgmramp -ellipse 160 160 -maxval=15 > ${ellipse_pgm}
for flag in "-compressed" "-maybecompressed" "-uncompressed"
    do
    pamtopdbimg -4depth ${flag} ${ellipse_pgm} | pdbimgtopam | \
      pamtopnm | pamdepth 15 | cmp -s - ${ellipse_pgm}
    echo ${PIPESTATUS[@]} ":" $?
    done
rm ${ellipse_pgm}