| 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 | #include <boost/spirit/include/karma_char.hpp> |
| 8 | #include <boost/spirit/include/karma_string.hpp> |
| 9 | #include <boost/spirit/include/karma_directive.hpp> |
| 10 | #include <boost/spirit/include/karma_action.hpp> |
| 11 | |
| 12 | #include <iostream> |
| 13 | #include "test.hpp" |
| 14 | |
| 15 | int |
| 16 | main() |
| 17 | { |
| 18 | using spirit_test::test; |
| 19 | using boost::spirit::karma::lit; |
| 20 | using boost::spirit::karma::lower; |
| 21 | using boost::spirit::karma::upper; |
| 22 | using boost::spirit::karma::char_; |
| 23 | using boost::spirit::karma::encoding; |
| 24 | namespace char_encoding = boost::spirit::char_encoding; |
| 25 | |
| 26 | encoding<char_encoding::iso8859_1> iso8859_1; |
| 27 | |
| 28 | { // test extended ASCII characters |
| 29 | BOOST_TEST(test("\xE1" , iso8859_1[lower['\xE1']])); |
| 30 | BOOST_TEST(test("\xC1" , iso8859_1[upper['\xE1']])); |
| 31 | BOOST_TEST(test("\xE1" , iso8859_1[lower[char_('\xE1')]])); |
| 32 | BOOST_TEST(test("\xC1" , iso8859_1[upper[char_('\xE1')]])); |
| 33 | BOOST_TEST(test("\xE1" , iso8859_1[lower[lit('\xE1')]])); |
| 34 | BOOST_TEST(test("\xC1" , iso8859_1[upper[lit('\xE1')]])); |
| 35 | BOOST_TEST(test("\xE1" , iso8859_1[lower[char_]], '\xE1')); |
| 36 | BOOST_TEST(test("\xC1" , iso8859_1[upper[char_]], '\xE1')); |
| 37 | BOOST_TEST(test("\xE1" , iso8859_1[lower['\xC1']])); |
| 38 | BOOST_TEST(test("\xC1" , iso8859_1[upper['\xC1']])); |
| 39 | BOOST_TEST(test("\xE1" , iso8859_1[lower[char_('\xC1')]])); |
| 40 | BOOST_TEST(test("\xC1" , iso8859_1[upper[char_('\xC1')]])); |
| 41 | BOOST_TEST(test("\xE1" , iso8859_1[lower[lit('\xC1')]])); |
| 42 | BOOST_TEST(test("\xC1" , iso8859_1[upper[lit('\xC1')]])); |
| 43 | BOOST_TEST(test("\xE1" , iso8859_1[lower[char_]], '\xC1')); |
| 44 | BOOST_TEST(test("\xC1" , iso8859_1[upper[char_]], '\xC1')); |
| 45 | |
| 46 | BOOST_TEST(test("\xE4\xE4" , iso8859_1[lower["\xC4\xE4" ]])); |
| 47 | BOOST_TEST(test("\xE4\xE4" , iso8859_1[lower[lit("\xC4\xE4" )]])); |
| 48 | |
| 49 | BOOST_TEST(test("\xC4\xC4" , iso8859_1[upper["\xC4\xE4" ]])); |
| 50 | BOOST_TEST(test("\xC4\xC4" , iso8859_1[upper[lit("\xC4\xE4" )]])); |
| 51 | } |
| 52 | |
| 53 | return boost::report_errors(); |
| 54 | } |
| 55 | |