• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2011 Jan Frederick Eick
3 
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 =============================================================================*/
7 
8 #include <boost/config/warning_disable.hpp>
9 #include <boost/detail/lightweight_test.hpp>
10 #include <boost/spirit/home/x3.hpp>
11 
12 #include <climits>
13 #include <cstring>
14 #include "test.hpp"
15 
16 #include "uint_radix.hpp"
17 
18 int
main()19 main()
20 {
21     using spirit_test::test;
22     using spirit_test::test_attr;
23 
24     using boost::spirit::x3::uint_parser;
25 
26     ///////////////////////////////////////////////////////////////////////////
27     //  arbitrary radix test (base 3)
28     ///////////////////////////////////////////////////////////////////////////
29     {
30         unsigned int u;
31         uint_parser<unsigned int, 3, 1, -1>             base3_parser;
32 
33         BOOST_TEST(test("210112221200",                 base3_parser));
34         BOOST_TEST(test_attr("210112221200",            base3_parser, u));
35         BOOST_TEST(424242 == u);
36 
37         BOOST_TEST(!test("1231",                        base3_parser));
38         BOOST_TEST(!test_attr("1231",                   base3_parser, u));
39 
40         BOOST_TEST(test(max_unsigned_base3,             base3_parser));
41         BOOST_TEST(test_attr(max_unsigned_base3,        base3_parser, u));
42 
43         BOOST_TEST(!test(unsigned_overflow_base3,       base3_parser));
44         BOOST_TEST(!test_attr(unsigned_overflow_base3,  base3_parser, u));
45         BOOST_TEST(!test(digit_overflow_base3,          base3_parser));
46         BOOST_TEST(!test_attr(digit_overflow_base3,     base3_parser, u));
47     }
48 
49     ///////////////////////////////////////////////////////////////////////////
50     //  arbitrary radix test (base 4)
51     ///////////////////////////////////////////////////////////////////////////
52     {
53         unsigned int u;
54 
55         uint_parser<unsigned int, 4, 1, -1>             base4_parser;
56 
57         BOOST_TEST(test("1213210302",                   base4_parser));
58         BOOST_TEST(test_attr("1213210302",              base4_parser, u));
59         BOOST_TEST(424242 == u);
60 
61         BOOST_TEST(!test("1234",                        base4_parser));
62         BOOST_TEST(!test_attr("1234",                   base4_parser, u));
63 
64         BOOST_TEST(test(max_unsigned_base4,             base4_parser));
65         BOOST_TEST(test_attr(max_unsigned_base4,        base4_parser, u));
66         BOOST_TEST(!test(digit_overflow_base4,          base4_parser));
67         BOOST_TEST(!test_attr(digit_overflow_base4,     base4_parser, u));
68     }
69 
70     ///////////////////////////////////////////////////////////////////////////
71     //  arbitrary radix test (base 5)
72     ///////////////////////////////////////////////////////////////////////////
73     {
74         unsigned int u;
75 
76         uint_parser<unsigned int, 5, 1, -1>             base5_parser;
77 
78         BOOST_TEST(test("102033432",                    base5_parser));
79         BOOST_TEST(test_attr("102033432",               base5_parser, u));
80         BOOST_TEST(424242 == u);
81 
82         BOOST_TEST(!test("2345",                        base5_parser));
83         BOOST_TEST(!test_attr("2345",                   base5_parser, u));
84 
85         BOOST_TEST(test(max_unsigned_base5,             base5_parser));
86         BOOST_TEST(test_attr(max_unsigned_base5,        base5_parser, u));
87 
88         BOOST_TEST(!test(unsigned_overflow_base5,       base5_parser));
89         BOOST_TEST(!test_attr(unsigned_overflow_base5,  base5_parser, u));
90         BOOST_TEST(!test(digit_overflow_base5,          base5_parser));
91         BOOST_TEST(!test_attr(digit_overflow_base5,     base5_parser, u));
92     }
93 
94     ///////////////////////////////////////////////////////////////////////////
95     //  arbitrary radix test (base 6)
96     ///////////////////////////////////////////////////////////////////////////
97     {
98         unsigned int u;
99 
100         uint_parser<unsigned int, 6, 1, -1>             base6_parser;
101 
102         BOOST_TEST(test("13032030",                     base6_parser));
103         BOOST_TEST(test_attr("13032030",                base6_parser, u));
104         BOOST_TEST(424242 == u);
105 
106         BOOST_TEST(!test("3456",                        base6_parser));
107         BOOST_TEST(!test_attr("3456",                   base6_parser, u));
108 
109         BOOST_TEST(test(max_unsigned_base6,             base6_parser));
110         BOOST_TEST(test_attr(max_unsigned_base6,        base6_parser, u));
111 
112         BOOST_TEST(!test(unsigned_overflow_base6,       base6_parser));
113         BOOST_TEST(!test_attr(unsigned_overflow_base6,  base6_parser, u));
114         BOOST_TEST(!test(digit_overflow_base6,          base6_parser));
115         BOOST_TEST(!test_attr(digit_overflow_base6,     base6_parser, u));
116     }
117 
118     ///////////////////////////////////////////////////////////////////////////
119     //  arbitrary radix test (base 7)
120     ///////////////////////////////////////////////////////////////////////////
121     {
122         unsigned int u;
123 
124         uint_parser<unsigned int, 7, 1, -1>             base7_parser;
125 
126         BOOST_TEST(test("3414600",                      base7_parser));
127         BOOST_TEST(test_attr("3414600",                 base7_parser, u));
128         BOOST_TEST(424242 == u);
129 
130         BOOST_TEST(!test("4567",                        base7_parser));
131         BOOST_TEST(!test_attr("4567",                   base7_parser, u));
132 
133         BOOST_TEST(test(max_unsigned_base7,             base7_parser));
134         BOOST_TEST(test_attr(max_unsigned_base7,        base7_parser, u));
135 
136         BOOST_TEST(!test(unsigned_overflow_base7,       base7_parser));
137         BOOST_TEST(!test_attr(unsigned_overflow_base7,  base7_parser, u));
138         BOOST_TEST(!test(digit_overflow_base7,          base7_parser));
139         BOOST_TEST(!test_attr(digit_overflow_base7,     base7_parser, u));
140     }
141 
142     ///////////////////////////////////////////////////////////////////////////
143     //  arbitrary radix test (base 9)
144     ///////////////////////////////////////////////////////////////////////////
145     {
146         unsigned int u;
147 
148         uint_parser<unsigned int, 9, 1, -1>             base9_parser;
149 
150         BOOST_TEST(test("715850",                       base9_parser));
151         BOOST_TEST(test_attr("715850",                  base9_parser, u));
152         BOOST_TEST(424242 == u);
153 
154         BOOST_TEST(!test("6789",                        base9_parser));
155         BOOST_TEST(!test_attr("6789",                   base9_parser, u));
156 
157         BOOST_TEST(test(max_unsigned_base9,             base9_parser));
158         BOOST_TEST(test_attr(max_unsigned_base9,        base9_parser, u));
159 
160         BOOST_TEST(!test(unsigned_overflow_base9,       base9_parser));
161         BOOST_TEST(!test_attr(unsigned_overflow_base9,  base9_parser, u));
162         BOOST_TEST(!test(digit_overflow_base9,          base9_parser));
163         BOOST_TEST(!test_attr(digit_overflow_base9,     base9_parser, u));
164     }
165 
166     ///////////////////////////////////////////////////////////////////////////
167     //  arbitrary radix test (base 11)
168     ///////////////////////////////////////////////////////////////////////////
169     {
170         unsigned int u;
171 
172         uint_parser<unsigned int, 11, 1, -1>            base11_parser;
173 
174         BOOST_TEST(test("26a815",                       base11_parser));
175         BOOST_TEST(test_attr("26a815",                  base11_parser, u));
176         BOOST_TEST(424242 == u);
177 
178         BOOST_TEST(!test("90ab",                        base11_parser));
179         BOOST_TEST(!test_attr("90AB",                   base11_parser, u));
180 
181         BOOST_TEST(test(max_unsigned_base11,            base11_parser));
182         BOOST_TEST(test_attr(max_unsigned_base11,       base11_parser, u));
183 
184         BOOST_TEST(!test(unsigned_overflow_base11,      base11_parser));
185         BOOST_TEST(!test_attr(unsigned_overflow_base11, base11_parser, u));
186         BOOST_TEST(!test(digit_overflow_base11,         base11_parser));
187         BOOST_TEST(!test_attr(digit_overflow_base11,    base11_parser, u));
188     }
189 
190     ///////////////////////////////////////////////////////////////////////////
191     //  arbitrary radix test (base 12)
192     ///////////////////////////////////////////////////////////////////////////
193     {
194         unsigned int u;
195         uint_parser<unsigned int, 12, 1, -1>            base12_parser;
196 
197         BOOST_TEST(test("185616",                       base12_parser));
198         BOOST_TEST(test_attr("185616",                  base12_parser, u));
199         BOOST_TEST(424242 == u);
200 
201         BOOST_TEST(!test("9abc",                        base12_parser));
202         BOOST_TEST(!test_attr("9ABC",                   base12_parser, u));
203 
204         BOOST_TEST(test(max_unsigned_base12,            base12_parser));
205         BOOST_TEST(test_attr(max_unsigned_base12,       base12_parser, u));
206 
207         BOOST_TEST(!test(unsigned_overflow_base12,      base12_parser));
208         BOOST_TEST(!test_attr(unsigned_overflow_base12, base12_parser, u));
209         BOOST_TEST(!test(digit_overflow_base12,         base12_parser));
210         BOOST_TEST(!test_attr(digit_overflow_base12,    base12_parser, u));
211     }
212 
213     ///////////////////////////////////////////////////////////////////////////
214     //  arbitrary radix test (base 13)
215     ///////////////////////////////////////////////////////////////////////////
216     {
217         unsigned int u;
218         uint_parser<unsigned int, 13, 1, -1>            base13_parser;
219 
220         BOOST_TEST(test("11b140",                       base13_parser));
221         BOOST_TEST(test_attr("11b140",                  base13_parser, u));
222         BOOST_TEST(424242 == u);
223 
224         BOOST_TEST(!test("abcd",                        base13_parser));
225         BOOST_TEST(!test_attr("ABCD",                   base13_parser, u));
226 
227         BOOST_TEST(test(max_unsigned_base13,            base13_parser));
228         BOOST_TEST(test_attr(max_unsigned_base13,       base13_parser, u));
229 
230         BOOST_TEST(!test(unsigned_overflow_base13,      base13_parser));
231         BOOST_TEST(!test_attr(unsigned_overflow_base13, base13_parser, u));
232         BOOST_TEST(!test(digit_overflow_base13,         base13_parser));
233         BOOST_TEST(!test_attr(digit_overflow_base13,    base13_parser, u));
234     }
235 
236     ///////////////////////////////////////////////////////////////////////////
237     //  arbitrary radix test (base 14)
238     ///////////////////////////////////////////////////////////////////////////
239     {
240         unsigned int u;
241         uint_parser<unsigned int, 14, 1, -1>            base14_parser;
242 
243         BOOST_TEST(test("b0870",                        base14_parser));
244         BOOST_TEST(test_attr("b0870",                   base14_parser, u));
245         BOOST_TEST(424242 == u);
246 
247         BOOST_TEST(!test("bcde",                        base14_parser));
248         BOOST_TEST(!test_attr("BCDE",                   base14_parser, u));
249 
250         BOOST_TEST(test(max_unsigned_base14,            base14_parser));
251         BOOST_TEST(test_attr(max_unsigned_base14,       base14_parser, u));
252 
253         BOOST_TEST(!test(unsigned_overflow_base14,      base14_parser));
254         BOOST_TEST(!test_attr(unsigned_overflow_base14, base14_parser, u));
255         BOOST_TEST(!test(digit_overflow_base14,         base14_parser));
256         BOOST_TEST(!test_attr(digit_overflow_base14,    base14_parser, u));
257     }
258 
259     ///////////////////////////////////////////////////////////////////////////
260     //  arbitrary radix test (base 15)
261     ///////////////////////////////////////////////////////////////////////////
262     {
263         unsigned int u;
264         uint_parser<unsigned int, 15, 1, -1>            base15_parser;
265 
266         BOOST_TEST(test("85a7c",                        base15_parser));
267         BOOST_TEST(test_attr("85a7c",                   base15_parser, u));
268         BOOST_TEST(424242 == u);
269 
270         BOOST_TEST(!test("cdef",                        base15_parser));
271         BOOST_TEST(!test_attr("CDEF",                   base15_parser, u));
272 
273         BOOST_TEST(test(max_unsigned_base15,            base15_parser));
274         BOOST_TEST(test_attr(max_unsigned_base15,       base15_parser, u));
275 
276         BOOST_TEST(!test(unsigned_overflow_base15,      base15_parser));
277         BOOST_TEST(!test_attr(unsigned_overflow_base15, base15_parser, u));
278         BOOST_TEST(!test(digit_overflow_base15,         base15_parser));
279         BOOST_TEST(!test_attr(digit_overflow_base15,    base15_parser, u));
280     }
281 
282     ///////////////////////////////////////////////////////////////////////////
283     //  arbitrary radix test (base 17)
284     ///////////////////////////////////////////////////////////////////////////
285     {
286         unsigned int u;
287         uint_parser<unsigned int, 17, 1, -1>            base17_parser;
288 
289         BOOST_TEST(test("515g7",                        base17_parser));
290         BOOST_TEST(test_attr("515g7",                   base17_parser, u));
291         BOOST_TEST(424242 == u);
292 
293         BOOST_TEST(!test("efgh",                        base17_parser));
294         BOOST_TEST(!test_attr("EFGH",                   base17_parser, u));
295 
296         BOOST_TEST(test(max_unsigned_base17,            base17_parser));
297         BOOST_TEST(test_attr(max_unsigned_base17,       base17_parser, u));
298 
299         BOOST_TEST(!test(unsigned_overflow_base17,      base17_parser));
300         BOOST_TEST(!test_attr(unsigned_overflow_base17, base17_parser, u));
301         BOOST_TEST(!test(digit_overflow_base17,         base17_parser));
302         BOOST_TEST(!test_attr(digit_overflow_base17,    base17_parser, u));
303     }
304 
305     ///////////////////////////////////////////////////////////////////////////
306     //  arbitrary radix test (base 18)
307     ///////////////////////////////////////////////////////////////////////////
308     {
309         unsigned int u;
310         uint_parser<unsigned int, 18, 1, -1>            base18_parser;
311 
312         BOOST_TEST(test("40d70",                        base18_parser));
313         BOOST_TEST(test_attr("40d70",                   base18_parser, u));
314         BOOST_TEST(424242 == u);
315 
316         BOOST_TEST(!test("fghi",                        base18_parser));
317         BOOST_TEST(!test_attr("FGHI",                   base18_parser, u));
318 
319         BOOST_TEST(test(max_unsigned_base18,            base18_parser));
320         BOOST_TEST(test_attr(max_unsigned_base18,       base18_parser, u));
321 
322         BOOST_TEST(!test(unsigned_overflow_base18,      base18_parser));
323         BOOST_TEST(!test_attr(unsigned_overflow_base18, base18_parser, u));
324         BOOST_TEST(!test(digit_overflow_base18,         base18_parser));
325         BOOST_TEST(!test_attr(digit_overflow_base18,    base18_parser, u));
326     }
327 
328     ///////////////////////////////////////////////////////////////////////////
329     //  arbitrary radix test (base 19)
330     ///////////////////////////////////////////////////////////////////////////
331     {
332         unsigned int u;
333         uint_parser<unsigned int, 19, 1, -1>            base19_parser;
334 
335         BOOST_TEST(test("34g3a",                        base19_parser));
336         BOOST_TEST(test_attr("34g3a",                   base19_parser, u));
337         BOOST_TEST(424242 == u);
338 
339         BOOST_TEST(!test("ghij",                        base19_parser));
340         BOOST_TEST(!test_attr("GHIJ",                   base19_parser, u));
341 
342         BOOST_TEST(test(max_unsigned_base19,            base19_parser));
343         BOOST_TEST(test_attr(max_unsigned_base19,       base19_parser, u));
344 
345         BOOST_TEST(!test(unsigned_overflow_base19,      base19_parser));
346         BOOST_TEST(!test_attr(unsigned_overflow_base19, base19_parser, u));
347         BOOST_TEST(!test(digit_overflow_base19,         base19_parser));
348         BOOST_TEST(!test_attr(digit_overflow_base19,    base19_parser, u));
349     }
350 
351     ///////////////////////////////////////////////////////////////////////////
352     //  arbitrary radix test (base 20)
353     ///////////////////////////////////////////////////////////////////////////
354     {
355         unsigned int u;
356         uint_parser<unsigned int, 20, 1, -1>            base20_parser;
357 
358         BOOST_TEST(test("2d0c2",                        base20_parser));
359         BOOST_TEST(test_attr("2d0c2",                   base20_parser, u));
360         BOOST_TEST(424242 == u);
361 
362         BOOST_TEST(!test("hijk",                        base20_parser));
363         BOOST_TEST(!test_attr("HIJK",                   base20_parser, u));
364 
365         BOOST_TEST(test(max_unsigned_base20,            base20_parser));
366         BOOST_TEST(test_attr(max_unsigned_base20,       base20_parser, u));
367 
368         BOOST_TEST(!test(unsigned_overflow_base20,      base20_parser));
369         BOOST_TEST(!test_attr(unsigned_overflow_base20, base20_parser, u));
370         BOOST_TEST(!test(digit_overflow_base20,         base20_parser));
371         BOOST_TEST(!test_attr(digit_overflow_base20,    base20_parser, u));
372     }
373 
374     ///////////////////////////////////////////////////////////////////////////
375     //  arbitrary radix test (base 21)
376     ///////////////////////////////////////////////////////////////////////////
377     {
378         unsigned int u;
379         uint_parser<unsigned int, 21, 1, -1>            base21_parser;
380 
381         BOOST_TEST(test("23h00",                        base21_parser));
382         BOOST_TEST(test_attr("23h00",                   base21_parser, u));
383         BOOST_TEST(424242 == u);
384 
385         BOOST_TEST(!test("ijkl",                        base21_parser));
386         BOOST_TEST(!test_attr("IJKL",                   base21_parser, u));
387 
388         BOOST_TEST(test(max_unsigned_base21,            base21_parser));
389         BOOST_TEST(test_attr(max_unsigned_base21,       base21_parser, u));
390 
391         BOOST_TEST(!test(unsigned_overflow_base21,      base21_parser));
392         BOOST_TEST(!test_attr(unsigned_overflow_base21, base21_parser, u));
393         BOOST_TEST(!test(digit_overflow_base21,         base21_parser));
394         BOOST_TEST(!test_attr(digit_overflow_base21,    base21_parser, u));
395     }
396 
397     ///////////////////////////////////////////////////////////////////////////
398     //  arbitrary radix test (base 22)
399     ///////////////////////////////////////////////////////////////////////////
400     {
401         unsigned int u;
402         uint_parser<unsigned int, 22, 1, -1>            base22_parser;
403 
404         BOOST_TEST(test("1hibg",                        base22_parser));
405         BOOST_TEST(test_attr("1hibg",                   base22_parser, u));
406         BOOST_TEST(424242 == u);
407 
408         BOOST_TEST(!test("jklm",                        base22_parser));
409         BOOST_TEST(!test_attr("JKLM",                   base22_parser, u));
410 
411         BOOST_TEST(test(max_unsigned_base22,            base22_parser));
412         BOOST_TEST(test_attr(max_unsigned_base22,       base22_parser, u));
413 
414         BOOST_TEST(!test(unsigned_overflow_base22,      base22_parser));
415         BOOST_TEST(!test_attr(unsigned_overflow_base22, base22_parser, u));
416         BOOST_TEST(!test(digit_overflow_base22,         base22_parser));
417         BOOST_TEST(!test_attr(digit_overflow_base22,    base22_parser, u));
418     }
419 
420     ///////////////////////////////////////////////////////////////////////////
421     //  arbitrary radix test (base 23)
422     ///////////////////////////////////////////////////////////////////////////
423     {
424         unsigned int u;
425         uint_parser<unsigned int, 23, 1, -1>            base23_parser;
426 
427         BOOST_TEST(test("1bjm7",                        base23_parser));
428         BOOST_TEST(test_attr("1bjm7",                   base23_parser, u));
429         BOOST_TEST(424242 == u);
430 
431         BOOST_TEST(!test("klmn",                        base23_parser));
432         BOOST_TEST(!test_attr("KLMN",                   base23_parser, u));
433 
434         BOOST_TEST(test(max_unsigned_base23,            base23_parser));
435         BOOST_TEST(test_attr(max_unsigned_base23,       base23_parser, u));
436 
437         BOOST_TEST(!test(unsigned_overflow_base23,      base23_parser));
438         BOOST_TEST(!test_attr(unsigned_overflow_base23, base23_parser, u));
439         BOOST_TEST(!test(digit_overflow_base23,         base23_parser));
440         BOOST_TEST(!test_attr(digit_overflow_base23,    base23_parser, u));
441     }
442 
443     ///////////////////////////////////////////////////////////////////////////
444     //  arbitrary radix test (base 24)
445     ///////////////////////////////////////////////////////////////////////////
446     {
447         unsigned int u;
448         uint_parser<unsigned int, 24, 1, -1>            base24_parser;
449 
450         BOOST_TEST(test("16gci",                        base24_parser));
451         BOOST_TEST(test_attr("16gci",                   base24_parser, u));
452         BOOST_TEST(424242 == u);
453 
454         BOOST_TEST(!test("lmno",                        base24_parser));
455         BOOST_TEST(!test_attr("LMNO",                   base24_parser, u));
456 
457         BOOST_TEST(test(max_unsigned_base24,            base24_parser));
458         BOOST_TEST(test_attr(max_unsigned_base24,       base24_parser, u));
459 
460         BOOST_TEST(!test(unsigned_overflow_base24,      base24_parser));
461         BOOST_TEST(!test_attr(unsigned_overflow_base24, base24_parser, u));
462         BOOST_TEST(!test(digit_overflow_base24,         base24_parser));
463         BOOST_TEST(!test_attr(digit_overflow_base24,    base24_parser, u));
464     }
465 
466     ///////////////////////////////////////////////////////////////////////////
467     //  arbitrary radix test (base 25)
468     ///////////////////////////////////////////////////////////////////////////
469     {
470         unsigned int u;
471         uint_parser<unsigned int, 25, 1, -1>            base25_parser;
472 
473         BOOST_TEST(test("123jh",                        base25_parser));
474         BOOST_TEST(test_attr("123jh",                   base25_parser, u));
475         BOOST_TEST(424242 == u);
476 
477         BOOST_TEST(!test("mnop",                        base25_parser));
478         BOOST_TEST(!test_attr("MNOP",                   base25_parser, u));
479 
480         BOOST_TEST(test(max_unsigned_base25,            base25_parser));
481         BOOST_TEST(test_attr(max_unsigned_base25,       base25_parser, u));
482 
483         BOOST_TEST(!test(unsigned_overflow_base25,      base25_parser));
484         BOOST_TEST(!test_attr(unsigned_overflow_base25, base25_parser, u));
485         BOOST_TEST(!test(digit_overflow_base25,         base25_parser));
486         BOOST_TEST(!test_attr(digit_overflow_base25,    base25_parser, u));
487     }
488 
489     ///////////////////////////////////////////////////////////////////////////
490     //  arbitrary radix test (base 26)
491     ///////////////////////////////////////////////////////////////////////////
492     {
493         unsigned int u;
494         uint_parser<unsigned int, 26, 1, -1>            base26_parser;
495 
496         BOOST_TEST(test("o3f0",                         base26_parser));
497         BOOST_TEST(test_attr("o3f0",                    base26_parser, u));
498         BOOST_TEST(424242 == u);
499 
500         BOOST_TEST(!test("nopq",                        base26_parser));
501         BOOST_TEST(!test_attr("NOPQ",                   base26_parser, u));
502 
503         BOOST_TEST(test(max_unsigned_base26,            base26_parser));
504         BOOST_TEST(test_attr(max_unsigned_base26,       base26_parser, u));
505 
506         BOOST_TEST(!test(unsigned_overflow_base26,      base26_parser));
507         BOOST_TEST(!test_attr(unsigned_overflow_base26, base26_parser, u));
508         BOOST_TEST(!test(digit_overflow_base26,         base26_parser));
509         BOOST_TEST(!test_attr(digit_overflow_base26,    base26_parser, u));
510     }
511 
512     ///////////////////////////////////////////////////////////////////////////
513     //  arbitrary radix test (base 27)
514     ///////////////////////////////////////////////////////////////////////////
515     {
516         unsigned int u;
517         uint_parser<unsigned int, 27, 1, -1>            base27_parser;
518 
519         BOOST_TEST(test("lepi",                         base27_parser));
520         BOOST_TEST(test_attr("lepi",                    base27_parser, u));
521         BOOST_TEST(424242 == u);
522 
523         BOOST_TEST(!test("opqr",                        base27_parser));
524         BOOST_TEST(!test_attr("OPQR",                   base27_parser, u));
525 
526         BOOST_TEST(test(max_unsigned_base27,            base27_parser));
527         BOOST_TEST(test_attr(max_unsigned_base27,       base27_parser, u));
528 
529         BOOST_TEST(!test(unsigned_overflow_base27,      base27_parser));
530         BOOST_TEST(!test_attr(unsigned_overflow_base27, base27_parser, u));
531         BOOST_TEST(!test(digit_overflow_base27,         base27_parser));
532         BOOST_TEST(!test_attr(digit_overflow_base27,    base27_parser, u));
533     }
534 
535     ///////////////////////////////////////////////////////////////////////////
536     //  arbitrary radix test (base 28)
537     ///////////////////////////////////////////////////////////////////////////
538     {
539         unsigned int u;
540         uint_parser<unsigned int, 28, 1, -1>            base28_parser;
541 
542         BOOST_TEST(test("j93e",                         base28_parser));
543         BOOST_TEST(test_attr("j93e",                    base28_parser, u));
544         BOOST_TEST(424242 == u);
545 
546         BOOST_TEST(!test("pqrs",                        base28_parser));
547         BOOST_TEST(!test_attr("PQRS",                   base28_parser, u));
548 
549         BOOST_TEST(test(max_unsigned_base28,            base28_parser));
550         BOOST_TEST(test_attr(max_unsigned_base28,       base28_parser, u));
551 
552         BOOST_TEST(!test(unsigned_overflow_base28,      base28_parser));
553         BOOST_TEST(!test_attr(unsigned_overflow_base28, base28_parser, u));
554         BOOST_TEST(!test(digit_overflow_base28,         base28_parser));
555         BOOST_TEST(!test_attr(digit_overflow_base28,    base28_parser, u));
556     }
557 
558     ///////////////////////////////////////////////////////////////////////////
559     //  arbitrary radix test (base 29)
560     ///////////////////////////////////////////////////////////////////////////
561     {
562         unsigned int u;
563         uint_parser<unsigned int, 29, 1, -1>            base29_parser;
564 
565         BOOST_TEST(test("hbd1",                         base29_parser));
566         BOOST_TEST(test_attr("hbd1",                    base29_parser, u));
567         BOOST_TEST(424242 == u);
568 
569         BOOST_TEST(!test("qrst",                        base29_parser));
570         BOOST_TEST(!test_attr("QRST",                   base29_parser, u));
571 
572         BOOST_TEST(test(max_unsigned_base29,            base29_parser));
573         BOOST_TEST(test_attr(max_unsigned_base29,       base29_parser, u));
574 
575         BOOST_TEST(!test(unsigned_overflow_base29,      base29_parser));
576         BOOST_TEST(!test_attr(unsigned_overflow_base29, base29_parser, u));
577         BOOST_TEST(!test(digit_overflow_base29,         base29_parser));
578         BOOST_TEST(!test_attr(digit_overflow_base29,    base29_parser, u));
579     }
580 
581     ///////////////////////////////////////////////////////////////////////////
582     //  arbitrary radix test (base 30)
583     ///////////////////////////////////////////////////////////////////////////
584     {
585         unsigned int u;
586         uint_parser<unsigned int, 30, 1, -1>            base30_parser;
587 
588         BOOST_TEST(test("flbc",                         base30_parser));
589         BOOST_TEST(test_attr("flbc",                    base30_parser, u));
590         BOOST_TEST(424242 == u);
591 
592         BOOST_TEST(!test("rstu",                        base30_parser));
593         BOOST_TEST(!test_attr("RSTU",                   base30_parser, u));
594 
595         BOOST_TEST(test(max_unsigned_base30,            base30_parser));
596         BOOST_TEST(test_attr(max_unsigned_base30,       base30_parser, u));
597 
598         BOOST_TEST(!test(unsigned_overflow_base30,      base30_parser));
599         BOOST_TEST(!test_attr(unsigned_overflow_base30, base30_parser, u));
600         BOOST_TEST(!test(digit_overflow_base30,         base30_parser));
601         BOOST_TEST(!test_attr(digit_overflow_base30,    base30_parser, u));
602     }
603 
604     ///////////////////////////////////////////////////////////////////////////
605     //  arbitrary radix test (base 31)
606     ///////////////////////////////////////////////////////////////////////////
607     {
608         unsigned int u;
609         uint_parser<unsigned int, 31, 1, -1>            base31_parser;
610 
611         BOOST_TEST(test("e7e7",                         base31_parser));
612         BOOST_TEST(test_attr("e7e7",                    base31_parser, u));
613         BOOST_TEST(424242 == u);
614 
615         BOOST_TEST(!test("stuv",                        base31_parser));
616         BOOST_TEST(!test_attr("STUV",                   base31_parser, u));
617 
618         BOOST_TEST(test(max_unsigned_base31,            base31_parser));
619         BOOST_TEST(test_attr(max_unsigned_base31,       base31_parser, u));
620 
621         BOOST_TEST(!test(unsigned_overflow_base31,      base31_parser));
622         BOOST_TEST(!test_attr(unsigned_overflow_base31, base31_parser, u));
623         BOOST_TEST(!test(digit_overflow_base31,         base31_parser));
624         BOOST_TEST(!test_attr(digit_overflow_base31,    base31_parser, u));
625     }
626 
627     ///////////////////////////////////////////////////////////////////////////
628     //  arbitrary radix test (base 32)
629     ///////////////////////////////////////////////////////////////////////////
630     {
631         unsigned int u;
632         uint_parser<unsigned int, 32, 1, -1>            base32_parser;
633 
634         BOOST_TEST(test("cu9i",                         base32_parser));
635         BOOST_TEST(test_attr("cu9i",                    base32_parser, u));
636         BOOST_TEST(424242 == u);
637 
638         BOOST_TEST(!test("tuvw",                        base32_parser));
639         BOOST_TEST(!test_attr("TUVW",                   base32_parser, u));
640 
641         BOOST_TEST(test(max_unsigned_base32,            base32_parser));
642         BOOST_TEST(test_attr(max_unsigned_base32,       base32_parser, u));
643 
644         BOOST_TEST(!test(unsigned_overflow_base32,      base32_parser));
645         BOOST_TEST(!test_attr(unsigned_overflow_base32, base32_parser, u));
646         BOOST_TEST(!test(digit_overflow_base32,         base32_parser));
647         BOOST_TEST(!test_attr(digit_overflow_base32,    base32_parser, u));
648     }
649 
650     ///////////////////////////////////////////////////////////////////////////
651     //  arbitrary radix test (base 33)
652     ///////////////////////////////////////////////////////////////////////////
653     {
654         unsigned int u;
655         uint_parser<unsigned int, 33, 1, -1>            base33_parser;
656 
657         BOOST_TEST(test("bqir",                         base33_parser));
658         BOOST_TEST(test_attr("bqir",                    base33_parser, u));
659         BOOST_TEST(424242 == u);
660 
661         BOOST_TEST(!test("uvwx",                        base33_parser));
662         BOOST_TEST(!test_attr("UVWX",                   base33_parser, u));
663 
664         BOOST_TEST(test(max_unsigned_base33,            base33_parser));
665         BOOST_TEST(test_attr(max_unsigned_base33,       base33_parser, u));
666 
667         BOOST_TEST(!test(unsigned_overflow_base33,      base33_parser));
668         BOOST_TEST(!test_attr(unsigned_overflow_base33, base33_parser, u));
669         BOOST_TEST(!test(digit_overflow_base33,         base33_parser));
670         BOOST_TEST(!test_attr(digit_overflow_base33,    base33_parser, u));
671     }
672 
673     ///////////////////////////////////////////////////////////////////////////
674     //  arbitrary radix test (base 34)
675     ///////////////////////////////////////////////////////////////////////////
676     {
677         unsigned int u;
678         uint_parser<unsigned int, 34, 1, -1>            base34_parser;
679 
680         BOOST_TEST(test("aqxo",                         base34_parser));
681         BOOST_TEST(test_attr("aqxo",                    base34_parser, u));
682         BOOST_TEST(424242 == u);
683 
684         BOOST_TEST(!test("vwxy",                        base34_parser));
685         BOOST_TEST(!test_attr("VWXY",                   base34_parser, u));
686 
687         BOOST_TEST(test(max_unsigned_base34,            base34_parser));
688         BOOST_TEST(test_attr(max_unsigned_base34,       base34_parser, u));
689 
690         BOOST_TEST(!test(unsigned_overflow_base34,      base34_parser));
691         BOOST_TEST(!test_attr(unsigned_overflow_base34, base34_parser, u));
692         BOOST_TEST(!test(digit_overflow_base34,         base34_parser));
693         BOOST_TEST(!test_attr(digit_overflow_base34,    base34_parser, u));
694     }
695 
696     ///////////////////////////////////////////////////////////////////////////
697     //  arbitrary radix test (base 35)
698     ///////////////////////////////////////////////////////////////////////////
699     {
700         unsigned int u;
701         uint_parser<unsigned int, 35, 1, -1>            base35_parser;
702 
703         BOOST_TEST(test("9vb7",                         base35_parser));
704         BOOST_TEST(test_attr("9vb7",                    base35_parser, u));
705         BOOST_TEST(424242 == u);
706 
707         BOOST_TEST(!test("wxyz",                        base35_parser));
708         BOOST_TEST(!test_attr("WXYZ",                   base35_parser, u));
709 
710         BOOST_TEST(test(max_unsigned_base35,            base35_parser));
711         BOOST_TEST(test_attr(max_unsigned_base35,       base35_parser, u));
712 
713         BOOST_TEST(!test(unsigned_overflow_base35,      base35_parser));
714         BOOST_TEST(!test_attr(unsigned_overflow_base35, base35_parser, u));
715         BOOST_TEST(!test(digit_overflow_base35,         base35_parser));
716         BOOST_TEST(!test_attr(digit_overflow_base35,    base35_parser, u));
717     }
718 
719     ///////////////////////////////////////////////////////////////////////////
720     //  arbitrary radix test (base 36)
721     ///////////////////////////////////////////////////////////////////////////
722     {
723         unsigned int u;
724         uint_parser<unsigned int, 36, 1, -1>            base36_parser;
725 
726         BOOST_TEST(test("93ci",                         base36_parser));
727         BOOST_TEST(test_attr("93ci",                    base36_parser, u));
728         BOOST_TEST(424242 == u);
729 
730         BOOST_TEST(test(max_unsigned_base36,            base36_parser));
731         BOOST_TEST(test_attr(max_unsigned_base36,       base36_parser, u));
732 
733         BOOST_TEST(!test(unsigned_overflow_base36,      base36_parser));
734         BOOST_TEST(!test_attr(unsigned_overflow_base36, base36_parser, u));
735         BOOST_TEST(!test(digit_overflow_base36,         base36_parser));
736         BOOST_TEST(!test_attr(digit_overflow_base36,    base36_parser, u));
737     }
738 
739     return boost::report_errors();
740 }
741