1 // Copyright (c) 2001-2011 Hartmut Kaiser
2 // Copyright (c) 2001-2011 Joel de Guzman
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 // this file intentionally contains non-ascii characters
8 // boostinspect:noascii
9
10 #include <boost/detail/lightweight_test.hpp>
11 #include <boost/spirit/include/karma_char.hpp>
12 #include <boost/spirit/include/karma_string.hpp>
13 #include <boost/spirit/include/karma_directive.hpp>
14 #include <boost/spirit/include/karma_action.hpp>
15 #include <boost/spirit/include/phoenix_core.hpp>
16 #include <boost/spirit/include/phoenix_operator.hpp>
17
18 #include <iostream>
19 #include "test.hpp"
20
21 int
main()22 main()
23 {
24 using spirit_test::test;
25 using boost::spirit::karma::lit;
26 using boost::spirit::karma::lower;
27 using boost::spirit::karma::upper;
28 using boost::spirit::karma::char_;
29 using boost::spirit::karma::encoding;
30 namespace char_encoding = boost::spirit::char_encoding;
31
32 encoding<char_encoding::iso8859_1> iso8859_1;
33
34 // needed for VC7.1 only
35 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
36 #pragma setlocale("french")
37 #endif
38
39 {
40 BOOST_TEST(test("�", iso8859_1[lower['�']]));
41 BOOST_TEST(test("�", iso8859_1[upper['�']]));
42 BOOST_TEST(test("�", iso8859_1[lower[char_('�')]]));
43 BOOST_TEST(test("�", iso8859_1[upper[char_('�')]]));
44 BOOST_TEST(test("�", iso8859_1[lower[lit('�')]]));
45 BOOST_TEST(test("�", iso8859_1[upper[lit('�')]]));
46 BOOST_TEST(test("�", iso8859_1[lower[char_]], '�'));
47 BOOST_TEST(test("�", iso8859_1[upper[char_]], '�'));
48 BOOST_TEST(test("�", iso8859_1[lower['�']]));
49 BOOST_TEST(test("�", iso8859_1[upper['�']]));
50 BOOST_TEST(test("�", iso8859_1[lower[char_('�')]]));
51 BOOST_TEST(test("�", iso8859_1[upper[char_('�')]]));
52 BOOST_TEST(test("�", iso8859_1[lower[lit('�')]]));
53 BOOST_TEST(test("�", iso8859_1[upper[lit('�')]]));
54 BOOST_TEST(test("�", iso8859_1[lower[char_]], '�'));
55 BOOST_TEST(test("�", iso8859_1[upper[char_]], '�'));
56 }
57
58 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
59 #pragma setlocale("")
60 #endif
61
62 // needed for VC7.1 only
63 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
64 #pragma setlocale("german")
65 #endif
66 {
67 BOOST_TEST(test("��", iso8859_1[lower["��"]]));
68 BOOST_TEST(test("��", iso8859_1[lower[lit("��")]]));
69
70 BOOST_TEST(test("��", iso8859_1[upper["��"]]));
71 BOOST_TEST(test("��", iso8859_1[upper[lit("��")]]));
72 }
73 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
74 #pragma setlocale("")
75 #endif
76
77 return boost::report_errors();
78 }
79