about summary refs log tree commit diff
path: root/test/facesaver-roundtrip.test
blob: 4c710e061acbd90b002c78e7f4990bc3d4d51a4c (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
#! /bin/sh
# This script tests: pgmtofs fstopgm
# Also requires: pamchannel pamtopnm pgmramp pgmmake

echo "Test 1.  Should produce 1571496937 33838"
# cksum of testimg.red

pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 |\
    pamtopnm | pgmtofs | fstopgm | cksum

echo "Test 2.  Should produce 2582999797 3376"
# pamdepth 255 maze.pbm | cksum 

pgmtofs maze.pbm | fstopgm | cksum

echo "Test 3.  Should produce 493599905 16"
# pgmramp -lr 5 1 | cksum

pgmramp -lr 5 1 | pgmtofs | fstopgm | cksum

tmpdir=${tmpdir:-/tmp}
test1_pgm=${tmpdir}/test1.pgm
test3_pgm=${tmpdir}/test3.pgm
test7_pgm=${tmpdir}/test7.pgm
test15_pgm=${tmpdir}/test15.pgm

echo "Test 4.1.  Should produce 3735757243 10"
pgmmake -maxval=1 0.1 1 1 | tee ${test1_pgm} | cksum

echo "Test 4.2.  Should produce 1655769442 10"
pgmmake -maxval=3 0.1 1 1 | tee ${test3_pgm} | cksum

echo "Test 4.3.  Should produce 3428680891 10"
pgmmake -maxval=7 0.1 1 1 | tee ${test7_pgm} | cksum

echo "Test 4.4.  Should produce 1663150238 11"
pgmmake -maxval=15 0.1 1 1 | tee ${test15_pgm} | cksum


echo "Test invalid"

. ./test-invalid.inc

test256_pgm=${tmpdir}/test256.pgm
test_fs=${tmpdir}/test.fs

pgmmake -maxval=256 0.1 1 1 > ${test256_pgm}
invCmd "pgmtofs ${test256_pgm}"
rm ${test256_pgm}

pgmtofs ${test1_pgm} > ${test_fs}
invCmd "fstopgm ${test_fs}"
rm ${test1_pgm} ${test_fs}

pgmtofs ${test3_pgm} > ${test_fs}
invCmd "fstopgm ${test_fs}"
rm ${test3_pgm} ${test_fs}

pgmtofs ${test7_pgm} > ${test_fs}
invCmd "fstopgm ${test_fs}"
rm ${test7_pgm} ${test_fs}

pgmtofs ${test15_pgm} > ${test_fs}
invCmd "fstopgm ${test_fs}"
rm ${test15_pgm} ${test_fs}