diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/spirit/test/karma/encoding.cpp | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/spirit/test/karma/encoding.cpp')
-rw-r--r-- | src/boost/libs/spirit/test/karma/encoding.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/boost/libs/spirit/test/karma/encoding.cpp b/src/boost/libs/spirit/test/karma/encoding.cpp new file mode 100644 index 00000000..05e8018c --- /dev/null +++ b/src/boost/libs/spirit/test/karma/encoding.cpp @@ -0,0 +1,55 @@ +// Copyright (c) 2001-2011 Hartmut Kaiser +// Copyright (c) 2001-2011 Joel de Guzman +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/detail/lightweight_test.hpp> +#include <boost/spirit/include/karma_char.hpp> +#include <boost/spirit/include/karma_string.hpp> +#include <boost/spirit/include/karma_directive.hpp> +#include <boost/spirit/include/karma_action.hpp> + +#include <iostream> +#include "test.hpp" + +int +main() +{ + using spirit_test::test; + using boost::spirit::karma::lit; + using boost::spirit::karma::lower; + using boost::spirit::karma::upper; + using boost::spirit::karma::char_; + using boost::spirit::karma::encoding; + namespace char_encoding = boost::spirit::char_encoding; + + encoding<char_encoding::iso8859_1> iso8859_1; + + { // test extended ASCII characters + BOOST_TEST(test("\xE1", iso8859_1[lower['\xE1']])); + BOOST_TEST(test("\xC1", iso8859_1[upper['\xE1']])); + BOOST_TEST(test("\xE1", iso8859_1[lower[char_('\xE1')]])); + BOOST_TEST(test("\xC1", iso8859_1[upper[char_('\xE1')]])); + BOOST_TEST(test("\xE1", iso8859_1[lower[lit('\xE1')]])); + BOOST_TEST(test("\xC1", iso8859_1[upper[lit('\xE1')]])); + BOOST_TEST(test("\xE1", iso8859_1[lower[char_]], '\xE1')); + BOOST_TEST(test("\xC1", iso8859_1[upper[char_]], '\xE1')); + BOOST_TEST(test("\xE1", iso8859_1[lower['\xC1']])); + BOOST_TEST(test("\xC1", iso8859_1[upper['\xC1']])); + BOOST_TEST(test("\xE1", iso8859_1[lower[char_('\xC1')]])); + BOOST_TEST(test("\xC1", iso8859_1[upper[char_('\xC1')]])); + BOOST_TEST(test("\xE1", iso8859_1[lower[lit('\xC1')]])); + BOOST_TEST(test("\xC1", iso8859_1[upper[lit('\xC1')]])); + BOOST_TEST(test("\xE1", iso8859_1[lower[char_]], '\xC1')); + BOOST_TEST(test("\xC1", iso8859_1[upper[char_]], '\xC1')); + + BOOST_TEST(test("\xE4\xE4", iso8859_1[lower["\xC4\xE4"]])); + BOOST_TEST(test("\xE4\xE4", iso8859_1[lower[lit("\xC4\xE4")]])); + + BOOST_TEST(test("\xC4\xC4", iso8859_1[upper["\xC4\xE4"]])); + BOOST_TEST(test("\xC4\xC4", iso8859_1[upper[lit("\xC4\xE4")]])); + } + + return boost::report_errors(); +} |