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/lazy.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/lazy.cpp')
-rw-r--r-- | src/boost/libs/spirit/test/karma/lazy.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/boost/libs/spirit/test/karma/lazy.cpp b/src/boost/libs/spirit/test/karma/lazy.cpp new file mode 100644 index 00000000..86476f01 --- /dev/null +++ b/src/boost/libs/spirit/test/karma/lazy.cpp @@ -0,0 +1,52 @@ +// Copyright (c) 2001-2011 Hartmut Kaiser +// +// 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/config/warning_disable.hpp> +#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_numeric.hpp> +#include <boost/spirit/include/karma_auxiliary.hpp> +#include <boost/spirit/include/karma_action.hpp> +// #include <boost/spirit/include/karma_nonterminal.hpp> +// #include <boost/spirit/include/karma_operator.hpp> +#include <boost/spirit/include/support_argument.hpp> +#include <boost/spirit/include/phoenix_core.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> + +#include <iostream> +#include "test.hpp" + +int +main() +{ + namespace karma = boost::spirit::karma; + using spirit_test::test; + using namespace boost::spirit; + using namespace boost::spirit::karma; + namespace phx = boost::phoenix; + + { + BOOST_TEST(test("123", karma::lazy(phx::val(int_)), 123)); + } + + { + int result = 123; + BOOST_TEST(test("123", karma::lazy(phx::val(int_))[_1 = phx::ref(result)])); + } + +// { +// typedef spirit_test::output_iterator<char>::type outiter_type; +// rule<outiter_type, void(std::string)> r; +// +// r = char_('<') << karma::lazy(_r1) << '>' << "</" << karma::lazy(_r1) << '>'; +// +// std::string tag("tag"), foo("foo"); +// BOOST_TEST(test("<tag></tag>", r (phx::ref(tag)))); +// BOOST_TEST(!test("<foo></bar>", r (phx::ref(foo)))); +// } + + return boost::report_errors(); +} |