-
Notifications
You must be signed in to change notification settings - Fork 6
/
tests.at
149 lines (126 loc) · 4.86 KB
/
tests.at
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
m4_define([AT_PACKAGE_BUGREPORT], [[email protected]])
m4_define([AT_PACKAGE_STRING], [qr])
AT_INIT
AT_COLOR_TESTS
AT_BANNER([QR-Code tests])
## 1
AT_SETUP([generates proper QR Code])
AT_CHECK_UNQUOTED([
convert -background black -fill white -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(./../../qr "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 2
AT_SETUP([generates proper QR Code using inverted colors])
AT_CHECK_UNQUOTED([
convert -background white -fill black -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(./../../qr -i "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 3
AT_SETUP([generates proper QR Code using compact blocks])
AT_CHECK_UNQUOTED([
convert -background black -fill white -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(./../../qr -c "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 4
AT_SETUP([generates proper QR Code using compact blocks and inverted colors])
AT_CHECK_UNQUOTED([
convert -background white -fill black -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(./../../qr -ci "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 5
AT_SETUP([generates proper QR Code using large blocks])
AT_CHECK_UNQUOTED([
convert -background black -fill white -font "${FONT}" -pointsize 4 -interline-spacing -1 label:"$(./../../qr -l "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 6
AT_SETUP([generates proper QR Code using large blocks and inverted colors])
AT_CHECK_UNQUOTED([
convert -background white -fill black -font "${FONT}" -pointsize 4 -interline-spacing -1 label:"$(./../../qr -li "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 7
AT_SETUP([generates proper QR Code using large compact blocks])
AT_CHECK_UNQUOTED([
convert -background black -fill white -font "${FONT}" -pointsize 4 -interline-spacing -1 label:"$(./../../qr -lc "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 8
AT_SETUP([generates proper QR Code using large compact blocks and inverted colors])
AT_CHECK_UNQUOTED([
convert -background white -fill black -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(./../../qr -lci "${INPUT}")" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 9
AT_SETUP([generates proper QR Code with default settings using stdin])
AT_CHECK_UNQUOTED([
convert -background black -fill white -font "${FONT}" -pointsize 9 -interline-spacing -1 label:"$(echo "${INPUT}" | ./../../qr)" png:- | zbarimg -q png:- | grep -q "QR-Code:${INPUT}" || exit 1
], [0], [], [])
AT_CLEANUP
## 10
AT_SETUP([fails to generate an empty QR Code])
AT_CHECK_UNQUOTED([./../../qr ""], [1], [], [\
Error: no input specified
Usage: qr [[OPTIONS]] STRING
or: cat FILE | qr [[OPTIONS]]
Options:
-m QR mode [[na8k]] (n = number, a = alphabet, 8 = 8-bit, k = Kanji)
-v QR version [[1-40]]
-e QR EC level [[lmqh]] or [[1-4]]
-l use two characters per block
-c compact mode
-b border width [[1-4]] (the default is 1)
-i invert colors
-p force colorless output
-h print help info and exit
-V print version info and exit
])
AT_CLEANUP
## 11
AT_SETUP([fails and prints help information when no arguments provided])
AT_CHECK_UNQUOTED([./../../qr], [1], [], [\
Error: no input specified
Usage: qr [[OPTIONS]] STRING
or: cat FILE | qr [[OPTIONS]]
Options:
-m QR mode [[na8k]] (n = number, a = alphabet, 8 = 8-bit, k = Kanji)
-v QR version [[1-40]]
-e QR EC level [[lmqh]] or [[1-4]]
-l use two characters per block
-c compact mode
-b border width [[1-4]] (the default is 1)
-i invert colors
-p force colorless output
-h print help info and exit
-V print version info and exit
])
AT_CLEANUP
## 12
AT_SETUP([prints help information when help flag is set])
AT_CHECK_UNQUOTED([./../../qr -h], [0], [\
Usage: qr [[OPTIONS]] STRING
or: cat FILE | qr [[OPTIONS]]
Options:
-m QR mode [[na8k]] (n = number, a = alphabet, 8 = 8-bit, k = Kanji)
-v QR version [[1-40]]
-e QR EC level [[lmqh]] or [[1-4]]
-l use two characters per block
-c compact mode
-b border width [[1-4]] (the default is 1)
-i invert colors
-p force colorless output
-h print help info and exit
-V print version info and exit
], [])
AT_CLEANUP
## 13
AT_SETUP([prints version informaton when version flag is set])
AT_CHECK_UNQUOTED([./../../qr -V], [0], [qr 1.0.0
], [])
AT_CLEANUP
## 14
AT_SETUP([fails if the input is too long])
AT_CHECK_UNQUOTED([./../../qr "${EXTRA_LONG_INPUT}"], [1], [], [\
Error: failed to generate QR code
])
AT_CLEANUP