about summary refs log tree commit diff
path: root/test/ppmpat.test
blob: acc44bdbcc0ec31fc4b3776b80227650124a8f08 (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
78
79
80
81
82
#! /bin/sh
# This script tests: ppmpat
# Also requires:

echo "Test 1. Should print: 4008533639 781"
ppmpat -gingham2 \
       -color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | cksum

echo "Test 2. Should print: 738714211 781"
ppmpat -g2 -mesh \
       --color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | cksum

echo "Test 3. Should print: 3805937800 9613"
ppmpat -gingham3 \
       -color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum

echo "Test 4. Should print: 1586690955 9613"
ppmpat -g3 -mesh \
       -color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum

echo "Test 5. Should print: 2698433077 1549"
ppmpat -madras \
       --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum

echo "Test 6. Should print: 1526189097 1549"
ppmpat -madras -mesh \
       --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum

echo "Test 7. Should print: 3705929501 781"
ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum

echo "Test 8. Should print: 1996587666 781"
ppmpat -tartan -mesh \
       --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum

echo "Test 9. Should print: 3057513592 661"
ppmpat -argyle1 --color=rgb:ff/ff/ff,rgb:ff/0/0 12 18 | cksum

echo "Test 10. Should print: 1861389287 661"
ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum

echo "Test Invalid"

. ./test-invalid.inc

invCmd "ppmpat -g2 -g3 10 10"
invCmd "ppmpat -madras -tartan 10 10"
invCmd "ppmpat -poles -squig 10 10"
invCmd "ppmpat -camo -anticamo 10 10"
invCmd "ppmpat -argyle1 -argyle2 10 10"
invCmd "ppmpat 10 10"
invCmd "ppmpat -g2 10"
invCmd "ppmpat -g2 10 10 10"
invCmd "ppmpat -g2 10"

clist1="-color=rgb:00/00/00"
clist2="-color=rgb:00/00/00,rgb:00/00/ff"
clist3="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff"
clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff"

# These patterns require exactly 2 colors
invCmd "ppmpat -gingham2 ${clist1} 10 10"
invCmd "ppmpat -argyle1  ${clist1} 10 10"
invCmd "ppmpat -gingham2 ${clist3} 10 10"
invCmd "ppmpat -argyle1  ${clist3} 10 10"

# These require exactly 3 colors
invCmd "ppmpat -gingham3 ${clist2} 10 10"
invCmd "ppmpat -argyle2  ${clist2} 10 10"
invCmd "ppmpat -madras   ${clist2} 10 10"
invCmd "ppmpat -tartan   ${clist2} 10 10"
invCmd "ppmpat -gingham3 ${clist4} 10 10"
invCmd "ppmpat -argyle2  ${clist4} 10 10"
invCmd "ppmpat -madras   ${clist4} 10 10"
invCmd "ppmpat -tartan   ${clist4} 10 10"
invCmd "ppmpat -squig    ${clist2} 10 10"
invCmd "ppmpat -camo     ${clist2} 10 10"
invCmd "ppmpat -anticamo ${clist2} 10 10"

# The squig pattern has an aspect ratio restriction
invCmd "ppmpat -squig ${clist3} 10 250"
invCmd "ppmpat -squig ${clist3} 500 20"