Debian Codegraph @

tests/t30_dumps.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 import common
3 from common import setup_module, teardown_module
4
5 class Data:
6
7 inputs = [
8 '\n',
9 'a\n',
10 'ab\n',
11 'abc\n',
12 'abcd\n',
13 'abcdefghi\n',
14 'abcdefghijklmnopqrs\n',
15 'abcdefghijklmnopqrstuvwzyzABC\n',
16 'abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLM\n',
17 'abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVW\n',
18 'abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456\n',
19 ]
20
21 class Test_Decimal(Data):
22
23 def test_d1_1(self):
24 # Single lines to Decimal-1.
25 common.request('../d1')
26 outputs = ['''\
27 10
28 ''', '''\
29 97, 10
30 ''', '''\
31 97, 98, 10
32 ''', '''\
33 97, 98, 99, 10
34 ''', '''\
35 97, 98, 99, 100, 10
36 ''', '''\
37 97, 98, 99, 100, 101, 102, 103, 104, 105, 10
38 ''', '''\
39 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
40 112, 113, 114, 115, 10
41 ''', '''\
42 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
43 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 10
44 ''', '''\
45 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
46 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 68,
47 69, 70, 71, 72, 73, 74, 75, 76, 77, 10
48 ''', '''\
49 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
50 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 68,
51 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
52 84, 85, 86, 87, 10
53 ''', '''\
54 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
55 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 68,
56 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
57 84, 85, 86, 87, 88, 89, 90, 48, 49, 50, 51, 52, 53, 54, 10
58 ''']
59 for input, output in zip(self.inputs, outputs):
60 common.validate(input, output)
61
62 def test_d1_2(self):
63 # Block of lines to Decimal-1.
64 common.request('../d1')
65 input = ''.join(self.inputs)
66 output = '''\
67 10, 97, 10, 97, 98, 10, 97, 98, 99, 10, 97, 98, 99, 100, 10,
68 97, 98, 99, 100, 101, 102, 103, 104, 105, 10, 97, 98, 99, 100, 101,
69 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 10,
70 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
71 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 10,
72 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
73 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 68,
74 69, 70, 71, 72, 73, 74, 75, 76, 77, 10, 97, 98, 99, 100, 101,
75 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
76 117, 118, 119, 122, 121, 122, 65, 66, 67, 68, 69, 70, 71, 72, 73,
77 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 10,
78 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
79 112, 113, 114, 115, 116, 117, 118, 119, 122, 121, 122, 65, 66, 67, 68,
80 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
81 84, 85, 86, 87, 88, 89, 90, 48, 49, 50, 51, 52, 53, 54, 10
82 '''
83 common.validate(input, output)
84
85 def test_d1_3(self):
86 # Single lines to Decimal-1 and back.
87 common.request('../d1')
88 for input in self.inputs:
89 common.validate_back(input)
90
91 def test_d1_4(self):
92 # Block of lines to Decimal-1 and back.
93 common.request('../d1')
94 input = ''.join(self.inputs)
95 common.validate_back(input)
96
97 def test_d2_1(self):
98 # Single lines to Decimal-2.
99 common.request('../d2')
100 outputs = ['''\
101 10
102 ''', '''\
103 24842
104 ''', '''\
105 24930, 10
106 ''', '''\
107 24930, 25354
108 ''', '''\
109 24930, 25444, 10
110 ''', '''\
111 24930, 25444, 25958, 26472, 26890
112 ''', '''\
113 24930, 25444, 25958, 26472, 26986, 27500, 28014, 28528, 29042, 29450
114 ''', '''\
115 24930, 25444, 25958, 26472, 26986, 27500, 28014, 28528, 29042, 29556,
116 30070, 30586, 31098, 16706, 17162
117 ''', '''\
118 24930, 25444, 25958, 26472, 26986, 27500, 28014, 28528, 29042, 29556,
119 30070, 30586, 31098, 16706, 17220, 17734, 18248, 18762, 19276, 19722
120 ''', '''\
121 24930, 25444, 25958, 26472, 26986, 27500, 28014, 28528, 29042, 29556,
122 30070, 30586, 31098, 16706, 17220, 17734, 18248, 18762, 19276, 19790,
123 20304, 20818, 21332, 21846, 22282
124 ''', '''\
125 24930, 25444, 25958, 26472, 26986, 27500, 28014, 28528, 29042, 29556,
126 30070, 30586, 31098, 16706, 17220, 17734, 18248, 18762, 19276, 19790,
127 20304, 20818, 21332, 21846, 22360, 22874, 12337, 12851, 13365, 13834
128 ''']
129 for input, output in zip(self.inputs, outputs):
130 common.validate(input, output)
131
132 def test_d2_2(self):
133 # Block of lines to Decimal-2.
134 common.request('../d2')
135 input = ''.join(self.inputs)
136 output = '''\
137 2657, 2657, 25098, 24930, 25354, 24930, 25444, 2657, 25187, 25701,
138 26215, 26729, 2657, 25187, 25701, 26215, 26729, 27243, 27757, 28271,
139 28785, 29299, 2657, 25187, 25701, 26215, 26729, 27243, 27757, 28271,
140 28785, 29299, 29813, 30327, 31353, 31297, 16963, 2657, 25187, 25701,
141 26215, 26729, 27243, 27757, 28271, 28785, 29299, 29813, 30327, 31353,
142 31297, 16963, 17477, 17991, 18505, 19019, 19533, 2657, 25187, 25701,
143 26215, 26729, 27243, 27757, 28271, 28785, 29299, 29813, 30327, 31353,
144 31297, 16963, 17477, 17991, 18505, 19019, 19533, 20047, 20561, 21075,
145 21589, 22103, 2657, 25187, 25701, 26215, 26729, 27243, 27757, 28271,
146 28785, 29299, 29813, 30327, 31353, 31297, 16963, 17477, 17991, 18505,
147 19019, 19533, 20047, 20561, 21075, 21589, 22103, 22617, 23088, 12594,
148 13108, 13622, 10
149 '''
150 common.validate(input, output)
151
152 def test_d2_3(self):
153 # Single lines to Decimal-2 and back.
154 common.request('../d2')
155 for input in self.inputs:
156 common.validate_back(input)
157
158 def test_d2_4(self):
159 # Block of lines to Decimal-2 and back.
160 common.request('../d2')
161 input = ''.join(self.inputs)
162 common.validate_back(input)
163
164 def test_d4_1(self):
165 # Single lines to Decimal-4.
166 common.request('../d4')
167 outputs = ['''\
168 10
169 ''', '''\
170 24842
171 ''', '''\
172 6382090
173 ''', '''\
174 1633837834
175 ''', '''\
176 1633837924, 10
177 ''', '''\
178 1633837924, 1701209960, 26890
179 ''', '''\
180 1633837924, 1701209960, 1768581996, 1835954032, 1903325962
181 ''', '''\
182 1633837924, 1701209960, 1768581996, 1835954032, 1903326068,
183 1970698106, 2038055234, 17162
184 ''', '''\
185 1633837924, 1701209960, 1768581996, 1835954032, 1903326068,
186 1970698106, 2038055234, 1128547654, 1195919690, 1263291658
187 ''', '''\
188 1633837924, 1701209960, 1768581996, 1835954032, 1903326068,
189 1970698106, 2038055234, 1128547654, 1195919690, 1263291726,
190 1330663762, 1398035798, 22282
191 ''', '''\
192 1633837924, 1701209960, 1768581996, 1835954032, 1903326068,
193 1970698106, 2038055234, 1128547654, 1195919690, 1263291726,
194 1330663762, 1398035798, 1465407834, 808530483, 875902474
195 ''']
196 for input, output in zip(self.inputs, outputs):
197 common.validate(input, output)
198
199 def test_d4_2(self):
200 # Block of lines to Decimal-4.
201 common.request('../d4')
202 input = ''.join(self.inputs)
203 output = '''\
204 174131809, 1644847458, 1661624674, 1667500641, 1650680933,
205 1718052969, 174154339, 1684366951, 1751738987, 1819111023,
206 1886483059, 174154339, 1684366951, 1751738987, 1819111023,
207 1886483059, 1953855095, 2054781505, 1111689825, 1650680933,
208 1718052969, 1785425005, 1852797041, 1920169077, 1987541625,
209 2051097155, 1145390663, 1212762699, 1280117345, 1650680933,
210 1718052969, 1785425005, 1852797041, 1920169077, 1987541625,
211 2051097155, 1145390663, 1212762699, 1280134735, 1347506771,
212 1414878807, 174154339, 1684366951, 1751738987, 1819111023,
213 1886483059, 1953855095, 2054781505, 1111704645, 1179076681,
214 1246448717, 1313820753, 1381192789, 1448564825, 1513107762,
215 859059510, 10
216 '''
217 common.validate(input, output)
218
219 def test_d4_3(self):
220 # Single lines to Decimal-4 and back.
221 common.request('../d4')
222 for input in self.inputs:
223 common.validate_back(input)
224
225 def test_d4_4(self):
226 # Block of lines to Decimal-4 and back.
227 common.request('../d4')
228 input = ''.join(self.inputs)
229 common.validate_back(input)
230
231 class Test_Hexadecimal(Data):
232
233 def test_x1_1(self):
234 # Single lines to Hexadecimal-1.
235 common.request('../x1')
236 outputs = ['''\
237 0x0A
238 ''', '''\
239 0x61, 0x0A
240 ''', '''\
241 0x61, 0x62, 0x0A
242 ''', '''\
243 0x61, 0x62, 0x63, 0x0A
244 ''', '''\
245 0x61, 0x62, 0x63, 0x64, 0x0A
246 ''', '''\
247 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x0A
248 ''', '''\
249 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
250 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x0A
251 ''', '''\
252 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
253 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A,
254 0x79, 0x7A, 0x41, 0x42, 0x43, 0x0A
255 ''', '''\
256 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
257 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A,
258 0x79, 0x7A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A,
259 0x4B, 0x4C, 0x4D, 0x0A
260 ''', '''\
261 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
262 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A,
263 0x79, 0x7A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A,
264 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
265 0x57, 0x0A
266 ''', '''\
267 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
268 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A,
269 0x79, 0x7A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A,
270 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
271 0x57, 0x58, 0x59, 0x5A, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x0A
272 ''']
273 for input, output in zip(self.inputs, outputs):
274 common.validate(input, output)
275
276 def test_x1_2(self):
277 # Block of lines to Hexadecimal-1.
278 common.request('../x1')
279 input = ''.join(self.inputs)
280 output = '''\
281 0x0A, 0x61, 0x0A, 0x61, 0x62, 0x0A, 0x61, 0x62, 0x63, 0x0A, 0x61, 0x62,
282 0x63, 0x64, 0x0A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
283 0x0A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
284 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x0A, 0x61, 0x62, 0x63,
285 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
286 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A, 0x79, 0x7A, 0x41,
287 0x42, 0x43, 0x0A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
288 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
289 0x76, 0x77, 0x7A, 0x79, 0x7A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
290 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x0A, 0x61, 0x62, 0x63, 0x64, 0x65,
291 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
292 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A, 0x79, 0x7A, 0x41, 0x42, 0x43,
293 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
294 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x0A, 0x61, 0x62, 0x63,
295 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
296 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x7A, 0x79, 0x7A, 0x41,
297 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
298 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
299 0x5A, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x0A
300 '''
301 common.validate(input, output)
302
303 def test_x1_3(self):
304 # Single lines to Hexadecimal-1 and back.
305 common.request('../x1')
306 for input in self.inputs:
307 common.validate_back(input)
308
309 def test_x1_4(self):
310 # Block of lines to Hexadecimal-1 and back.
311 common.request('../x1')
312 input = ''.join(self.inputs)
313 common.validate_back(input)
314
315 def test_x2_1(self):
316 # Single lines to Hexadecimal-2.
317 common.request('../x2')
318 outputs = ['''\
319 0x0A
320 ''', '''\
321 0x610A
322 ''', '''\
323 0x6162, 0x0A
324 ''', '''\
325 0x6162, 0x630A
326 ''', '''\
327 0x6162, 0x6364, 0x0A
328 ''', '''\
329 0x6162, 0x6364, 0x6566, 0x6768, 0x690A
330 ''', '''\
331 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
332 0x7172, 0x730A
333 ''', '''\
334 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
335 0x7172, 0x7374, 0x7576, 0x777A, 0x797A, 0x4142, 0x430A
336 ''', '''\
337 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
338 0x7172, 0x7374, 0x7576, 0x777A, 0x797A, 0x4142, 0x4344, 0x4546,
339 0x4748, 0x494A, 0x4B4C, 0x4D0A
340 ''', '''\
341 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
342 0x7172, 0x7374, 0x7576, 0x777A, 0x797A, 0x4142, 0x4344, 0x4546,
343 0x4748, 0x494A, 0x4B4C, 0x4D4E, 0x4F50, 0x5152, 0x5354, 0x5556,
344 0x570A
345 ''', '''\
346 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
347 0x7172, 0x7374, 0x7576, 0x777A, 0x797A, 0x4142, 0x4344, 0x4546,
348 0x4748, 0x494A, 0x4B4C, 0x4D4E, 0x4F50, 0x5152, 0x5354, 0x5556,
349 0x5758, 0x595A, 0x3031, 0x3233, 0x3435, 0x360A
350 ''']
351 for input, output in zip(self.inputs, outputs):
352 common.validate(input, output)
353
354 def test_x2_2(self):
355 # Block of lines to Hexadecimal-2.
356 common.request('../x2')
357 input = ''.join(self.inputs)
358 output = '''\
359 0x0A61, 0x0A61, 0x620A, 0x6162, 0x630A, 0x6162, 0x6364, 0x0A61,
360 0x6263, 0x6465, 0x6667, 0x6869, 0x0A61, 0x6263, 0x6465, 0x6667,
361 0x6869, 0x6A6B, 0x6C6D, 0x6E6F, 0x7071, 0x7273, 0x0A61, 0x6263,
362 0x6465, 0x6667, 0x6869, 0x6A6B, 0x6C6D, 0x6E6F, 0x7071, 0x7273,
363 0x7475, 0x7677, 0x7A79, 0x7A41, 0x4243, 0x0A61, 0x6263, 0x6465,
364 0x6667, 0x6869, 0x6A6B, 0x6C6D, 0x6E6F, 0x7071, 0x7273, 0x7475,
365 0x7677, 0x7A79, 0x7A41, 0x4243, 0x4445, 0x4647, 0x4849, 0x4A4B,
366 0x4C4D, 0x0A61, 0x6263, 0x6465, 0x6667, 0x6869, 0x6A6B, 0x6C6D,
367 0x6E6F, 0x7071, 0x7273, 0x7475, 0x7677, 0x7A79, 0x7A41, 0x4243,
368 0x4445, 0x4647, 0x4849, 0x4A4B, 0x4C4D, 0x4E4F, 0x5051, 0x5253,
369 0x5455, 0x5657, 0x0A61, 0x6263, 0x6465, 0x6667, 0x6869, 0x6A6B,
370 0x6C6D, 0x6E6F, 0x7071, 0x7273, 0x7475, 0x7677, 0x7A79, 0x7A41,
371 0x4243, 0x4445, 0x4647, 0x4849, 0x4A4B, 0x4C4D, 0x4E4F, 0x5051,
372 0x5253, 0x5455, 0x5657, 0x5859, 0x5A30, 0x3132, 0x3334, 0x3536,
373 0x0A
374 '''
375 common.validate(input, output)
376
377 def test_x2_3(self):
378 # Single lines to Hexadecimal-2 and back.
379 common.request('../x2')
380 for input in self.inputs:
381 common.validate_back(input)
382
383 def test_x2_4(self):
384 # Block of lines to Hexadecimal-2 and back.
385 common.request('../x2')
386 input = ''.join(self.inputs)
387 common.validate_back(input)
388
389 def test_x4_1(self):
390 # Single lines to Hexadecimal-4.
391 common.request('../x4')
392 outputs = ['''\
393 0x0A
394 ''', '''\
395 0x610A
396 ''', '''\
397 0x61620A
398 ''', '''\
399 0x6162630A
400 ''', '''\
401 0x61626364, 0x0A
402 ''', '''\
403 0x61626364, 0x65666768, 0x690A
404 ''', '''\
405 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70, 0x7172730A
406 ''', '''\
407 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70, 0x71727374, 0x7576777A,
408 0x797A4142, 0x430A
409 ''', '''\
410 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70, 0x71727374, 0x7576777A,
411 0x797A4142, 0x43444546, 0x4748494A, 0x4B4C4D0A
412 ''', '''\
413 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70, 0x71727374, 0x7576777A,
414 0x797A4142, 0x43444546, 0x4748494A, 0x4B4C4D4E, 0x4F505152, 0x53545556,
415 0x570A
416 ''', '''\
417 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70, 0x71727374, 0x7576777A,
418 0x797A4142, 0x43444546, 0x4748494A, 0x4B4C4D4E, 0x4F505152, 0x53545556,
419 0x5758595A, 0x30313233, 0x3435360A
420 ''']
421 for input, output in zip(self.inputs, outputs):
422 common.validate(input, output)
423
424 def test_x4_2(self):
425 # Block of lines to Hexadecimal-4.
426 common.request('../x4')
427 input = ''.join(self.inputs)
428 output = '''\
429 0x0A610A61, 0x620A6162, 0x630A6162, 0x63640A61, 0x62636465, 0x66676869,
430 0x0A616263, 0x64656667, 0x68696A6B, 0x6C6D6E6F, 0x70717273, 0x0A616263,
431 0x64656667, 0x68696A6B, 0x6C6D6E6F, 0x70717273, 0x74757677, 0x7A797A41,
432 0x42430A61, 0x62636465, 0x66676869, 0x6A6B6C6D, 0x6E6F7071, 0x72737475,
433 0x76777A79, 0x7A414243, 0x44454647, 0x48494A4B, 0x4C4D0A61, 0x62636465,
434 0x66676869, 0x6A6B6C6D, 0x6E6F7071, 0x72737475, 0x76777A79, 0x7A414243,
435 0x44454647, 0x48494A4B, 0x4C4D4E4F, 0x50515253, 0x54555657, 0x0A616263,
436 0x64656667, 0x68696A6B, 0x6C6D6E6F, 0x70717273, 0x74757677, 0x7A797A41,
437 0x42434445, 0x46474849, 0x4A4B4C4D, 0x4E4F5051, 0x52535455, 0x56575859,
438 0x5A303132, 0x33343536, 0x0A
439 '''
440 common.validate(input, output)
441
442 def test_x4_3(self):
443 # Single lines to Hexadecimal-4 and back.
444 common.request('../x4')
445 for input in self.inputs:
446 common.validate_back(input)
447
448 def test_x4_4(self):
449 # Block of lines to Hexadecimal-4 and back.
450 common.request('../x4')
451 input = ''.join(self.inputs)
452 common.validate_back(input)
453
454 class Test_Octal(Data):
455
456 def test_o1_1(self):
457 # Single lines to Octal-1.
458 common.request('../o1')
459 outputs = ['''\
460 0012
461 ''', '''\
462 0141, 0012
463 ''', '''\
464 0141, 0142, 0012
465 ''', '''\
466 0141, 0142, 0143, 0012
467 ''', '''\
468 0141, 0142, 0143, 0144, 0012
469 ''', '''\
470 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0012
471 ''', '''\
472 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154,
473 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0012
474 ''', '''\
475 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154,
476 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172,
477 0171, 0172, 0101, 0102, 0103, 0012
478 ''', '''\
479 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154,
480 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172,
481 0171, 0172, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112,
482 0113, 0114, 0115, 0012
483 ''', '''\
484 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154,
485 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172,
486 0171, 0172, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112,
487 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126,
488 0127, 0012
489 ''', '''\
490 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154,
491 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172,
492 0171, 0172, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112,
493 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126,
494 0127, 0130, 0131, 0132, 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0012
495 ''']
496 for input, output in zip(self.inputs, outputs):
497 common.validate(input, output)
498
499 def test_o1_2(self):
500 # Block of lines to Octal-1.
501 common.request('../o1')
502 input = ''.join(self.inputs)
503 output = '''\
504 0012, 0141, 0012, 0141, 0142, 0012, 0141, 0142, 0143, 0012, 0141, 0142,
505 0143, 0144, 0012, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151,
506 0012, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153,
507 0154, 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0012, 0141, 0142, 0143,
508 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
509 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172, 0171, 0172, 0101,
510 0102, 0103, 0012, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151,
511 0152, 0153, 0154, 0155, 0156, 0157, 0160, 0161, 0162, 0163, 0164, 0165,
512 0166, 0167, 0172, 0171, 0172, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
513 0110, 0111, 0112, 0113, 0114, 0115, 0012, 0141, 0142, 0143, 0144, 0145,
514 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, 0160, 0161,
515 0162, 0163, 0164, 0165, 0166, 0167, 0172, 0171, 0172, 0101, 0102, 0103,
516 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
517 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0012, 0141, 0142, 0143,
518 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
519 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0172, 0171, 0172, 0101,
520 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115,
521 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131,
522 0132, 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0012
523 '''
524 common.validate(input, output)
525
526 def test_o1_3(self):
527 # Single lines to Octal-1 and back.
528 common.request('../o1')
529 for input in self.inputs:
530 common.validate_back(input)
531
532 def test_o1_4(self):
533 # Block of lines to Octal-1 and back.
534 common.request('../o1')
535 input = ''.join(self.inputs)
536 common.validate_back(input)
537
538 def test_o2_1(self):
539 # Single lines to Octal-2.
540 common.request('../o2')
541 outputs = ['''\
542 0012
543 ''', '''\
544 0060412
545 ''', '''\
546 0060542, 0012
547 ''', '''\
548 0060542, 0061412
549 ''', '''\
550 0060542, 0061544, 0012
551 ''', '''\
552 0060542, 0061544, 0062546, 0063550, 0064412
553 ''', '''\
554 0060542, 0061544, 0062546, 0063550, 0064552, 0065554, 0066556, 0067560,
555 0070562, 0071412
556 ''', '''\
557 0060542, 0061544, 0062546, 0063550, 0064552, 0065554, 0066556, 0067560,
558 0070562, 0071564, 0072566, 0073572, 0074572, 0040502, 0041412
559 ''', '''\
560 0060542, 0061544, 0062546, 0063550, 0064552, 0065554, 0066556, 0067560,
561 0070562, 0071564, 0072566, 0073572, 0074572, 0040502, 0041504, 0042506,
562 0043510, 0044512, 0045514, 0046412
563 ''', '''\
564 0060542, 0061544, 0062546, 0063550, 0064552, 0065554, 0066556, 0067560,
565 0070562, 0071564, 0072566, 0073572, 0074572, 0040502, 0041504, 0042506,
566 0043510, 0044512, 0045514, 0046516, 0047520, 0050522, 0051524, 0052526,
567 0053412
568 ''', '''\
569 0060542, 0061544, 0062546, 0063550, 0064552, 0065554, 0066556, 0067560,
570 0070562, 0071564, 0072566, 0073572, 0074572, 0040502, 0041504, 0042506,
571 0043510, 0044512, 0045514, 0046516, 0047520, 0050522, 0051524, 0052526,
572 0053530, 0054532, 0030061, 0031063, 0032065, 0033012
573 ''']
574 for input, output in zip(self.inputs, outputs):
575 common.validate(input, output)
576
577 def test_o2_2(self):
578 # Block of lines to Octal-2.
579 common.request('../o2')
580 input = ''.join(self.inputs)
581 output = '''\
582 0005141, 0005141, 0061012, 0060542, 0061412, 0060542, 0061544, 0005141,
583 0061143, 0062145, 0063147, 0064151, 0005141, 0061143, 0062145, 0063147,
584 0064151, 0065153, 0066155, 0067157, 0070161, 0071163, 0005141, 0061143,
585 0062145, 0063147, 0064151, 0065153, 0066155, 0067157, 0070161, 0071163,
586 0072165, 0073167, 0075171, 0075101, 0041103, 0005141, 0061143, 0062145,
587 0063147, 0064151, 0065153, 0066155, 0067157, 0070161, 0071163, 0072165,
588 0073167, 0075171, 0075101, 0041103, 0042105, 0043107, 0044111, 0045113,
589 0046115, 0005141, 0061143, 0062145, 0063147, 0064151, 0065153, 0066155,
590 0067157, 0070161, 0071163, 0072165, 0073167, 0075171, 0075101, 0041103,
591 0042105, 0043107, 0044111, 0045113, 0046115, 0047117, 0050121, 0051123,
592 0052125, 0053127, 0005141, 0061143, 0062145, 0063147, 0064151, 0065153,
593 0066155, 0067157, 0070161, 0071163, 0072165, 0073167, 0075171, 0075101,
594 0041103, 0042105, 0043107, 0044111, 0045113, 0046115, 0047117, 0050121,
595 0051123, 0052125, 0053127, 0054131, 0055060, 0030462, 0031464, 0032466,
596 0012
597 '''
598 common.validate(input, output)
599
600 def test_o2_3(self):
601 # Single lines to Octal-2 and back.
602 common.request('../o2')
603 for input in self.inputs:
604 common.validate_back(input)
605
606 def test_o2_4(self):
607 # Block of lines to Octal-2 and back.
608 common.request('../o2')
609 input = ''.join(self.inputs)
610 common.validate_back(input)
611
612 def test_o4_1(self):
613 # Single lines to Octal-4.
614 common.request('../o4')
615 outputs = ['''\
616 0012
617 ''', '''\
618 0060412
619 ''', '''\
620 030261012
621 ''', '''\
622 014130461412
623 ''', '''\
624 014130461544, 0012
625 ''', '''\
626 014130461544, 014531463550, 0064412
627 ''', '''\
628 014130461544, 014531463550, 015132465554, 015533467560,
629 016134471412
630 ''', '''\
631 014130461544, 014531463550, 015132465554, 015533467560,
632 016134471564, 016535473572, 017136440502, 0041412
633 ''', '''\
634 014130461544, 014531463550, 015132465554, 015533467560,
635 016134471564, 016535473572, 017136440502, 010321042506,
636 010722044512, 011323046412
637 ''', '''\
638 014130461544, 014531463550, 015132465554, 015533467560,
639 016134471564, 016535473572, 017136440502, 010321042506,
640 010722044512, 011323046516, 011724050522, 012325052526,
641 0053412
642 ''', '''\
643 014130461544, 014531463550, 015132465554, 015533467560,
644 016134471564, 016535473572, 017136440502, 010321042506,
645 010722044512, 011323046516, 011724050522, 012325052526,
646 012726054532, 006014231063, 006415233012
647 ''']
648 for input, output in zip(self.inputs, outputs):
649 common.validate(input, output)
650
651 def test_o4_2(self):
652 # Block of lines to Octal-4.
653 common.request('../o4')
654 input = ''.join(self.inputs)
655 output = '''\
656 001230205141, 014202460542, 014302460542, 014331005141,
657 014230662145, 014631664151, 001230261143, 014431263147,
658 015032265153, 015433267157, 016034271163, 001230261143,
659 014431263147, 015032265153, 015433267157, 016034271163,
660 016435273167, 017236275101, 010220605141, 014230662145,
661 014631664151, 015232666155, 015633670161, 016234672165,
662 016635675171, 017220241103, 010421243107, 011022245113,
663 011423205141, 014230662145, 014631664151, 015232666155,
664 015633670161, 016234672165, 016635675171, 017220241103,
665 010421243107, 011022245113, 011423247117, 012024251123,
666 012425253127, 001230261143, 014431263147, 015032265153,
667 015433267157, 016034271163, 016435273167, 017236275101,
668 010220642105, 010621644111, 011222646115, 011623650121,
669 012224652125, 012625654131, 013214030462, 006315032466,
670 0012
671 '''
672 common.validate(input, output)
673
674 def test_o4_3(self):
675 # Single lines to Octal-4 and back.
676 common.request('../o4')
677 for input in self.inputs:
678 common.validate_back(input)
679
680 def test_o4_4(self):
681 # Block of lines to Octal-4 and back.
682 common.request('../o4')
683 input = ''.join(self.inputs)
684 common.validate_back(input)