• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  Copyright (c) 2001-2010 Hartmut Kaiser
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/config/warning_disable.hpp>
7 #include <boost/detail/lightweight_test.hpp>
8 #include <boost/detail/workaround.hpp>
9 
10 #include <boost/spirit/include/karma_char.hpp>
11 #include <boost/spirit/include/karma_string.hpp>
12 #include <boost/spirit/include/karma_generate.hpp>
13 #include <boost/spirit/include/karma_directive.hpp>
14 
15 #include "test.hpp"
16 
17 using namespace spirit_test;
18 
19 ///////////////////////////////////////////////////////////////////////////////
20 int
main()21 main()
22 {
23     using namespace boost::spirit;
24 
25     {
26         using namespace boost::spirit::ascii;
27 
28         BOOST_TEST(test("x", lower['X']));
29         BOOST_TEST(test("x", lower['x']));
30 
31         BOOST_TEST(test("x", lower[char_], 'X'));
32         BOOST_TEST(test("x", lower[char_], 'x'));
33         BOOST_TEST(test("x", lower[char_('X')]));
34         BOOST_TEST(test("x", lower[char_('x')]));
35 
36         BOOST_TEST(test(" ", lower[space]));
37         BOOST_TEST(test("\t", lower[space], '\t'));
38 
39         BOOST_TEST(test("x", lower[lower['X']]));
40         BOOST_TEST(test("x", lower[lower['x']]));
41 
42         BOOST_TEST(test("x", lower[lower[char_]], 'X'));
43         BOOST_TEST(test("x", lower[lower[char_]], 'x'));
44         BOOST_TEST(test("x", lower[lower[char_('X')]]));
45         BOOST_TEST(test("x", lower[lower[char_('x')]]));
46 
47         BOOST_TEST(test(" ", lower[lower[space]]));
48         BOOST_TEST(test("\t", lower[lower[space]], '\t'));
49 
50         BOOST_TEST(test("X", upper[lower['X']]));
51         BOOST_TEST(test("X", upper[lower['x']]));
52 
53         BOOST_TEST(test("X", upper[lower[char_]], 'X'));
54         BOOST_TEST(test("X", upper[lower[char_]], 'x'));
55         BOOST_TEST(test("X", upper[lower[char_('X')]]));
56         BOOST_TEST(test("X", upper[lower[char_('x')]]));
57 
58         BOOST_TEST(test(" ", upper[lower[space]]));
59         BOOST_TEST(test("\t", upper[lower[space]], '\t'));
60 
61         BOOST_TEST(test("X", upper['X']));
62         BOOST_TEST(test("X", upper['x']));
63 
64         BOOST_TEST(test("X", upper[char_], 'X'));
65         BOOST_TEST(test("X", upper[char_], 'x'));
66         BOOST_TEST(test("X", upper[char_('X')]));
67         BOOST_TEST(test("X", upper[char_('x')]));
68 
69         BOOST_TEST(test(" ", upper[space]));
70         BOOST_TEST(test("\t", upper[space], '\t'));
71 
72         BOOST_TEST(test("x", lower[upper['X']]));
73         BOOST_TEST(test("x", lower[upper['x']]));
74 
75         BOOST_TEST(test("x", lower[upper[char_]], 'X'));
76         BOOST_TEST(test("x", lower[upper[char_]], 'x'));
77         BOOST_TEST(test("x", lower[upper[char_('X')]]));
78         BOOST_TEST(test("x", lower[upper[char_('x')]]));
79 
80         BOOST_TEST(test(" ", lower[upper[space]]));
81         BOOST_TEST(test("\t", lower[upper[space]], '\t'));
82 
83         BOOST_TEST(test("X", upper[upper['X']]));
84         BOOST_TEST(test("X", upper[upper['x']]));
85 
86         BOOST_TEST(test("X", upper[upper[char_]], 'X'));
87         BOOST_TEST(test("X", upper[upper[char_]], 'x'));
88         BOOST_TEST(test("X", upper[upper[char_('X')]]));
89         BOOST_TEST(test("X", upper[upper[char_('x')]]));
90 
91         BOOST_TEST(test(" ", upper[upper[space]]));
92         BOOST_TEST(test("\t", upper[upper[space]], '\t'));
93     }
94 
95     return boost::report_errors();
96 }
97