1 // Copyright (c) 2001-2011 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/spirit/include/karma_char.hpp> 9 #include <boost/spirit/include/karma_string.hpp> 10 #include <boost/spirit/include/karma_numeric.hpp> 11 #include <boost/spirit/include/karma_auxiliary.hpp> 12 #include <boost/spirit/include/karma_action.hpp> 13 // #include <boost/spirit/include/karma_nonterminal.hpp> 14 // #include <boost/spirit/include/karma_operator.hpp> 15 #include <boost/spirit/include/support_argument.hpp> 16 #include <boost/spirit/include/phoenix_core.hpp> 17 #include <boost/spirit/include/phoenix_operator.hpp> 18 19 #include <iostream> 20 #include "test.hpp" 21 22 int main()23main() 24 { 25 namespace karma = boost::spirit::karma; 26 using spirit_test::test; 27 using namespace boost::spirit; 28 using namespace boost::spirit::karma; 29 namespace phx = boost::phoenix; 30 31 { 32 BOOST_TEST(test("123", karma::lazy(phx::val(int_)), 123)); 33 } 34 35 { 36 int result = 123; 37 BOOST_TEST(test("123", karma::lazy(phx::val(int_))[_1 = phx::ref(result)])); 38 } 39 40 // { 41 // typedef spirit_test::output_iterator<char>::type outiter_type; 42 // rule<outiter_type, void(std::string)> r; 43 // 44 // r = char_('<') << karma::lazy(_r1) << '>' << "</" << karma::lazy(_r1) << '>'; 45 // 46 // std::string tag("tag"), foo("foo"); 47 // BOOST_TEST(test("<tag></tag>", r (phx::ref(tag)))); 48 // BOOST_TEST(!test("<foo></bar>", r (phx::ref(foo)))); 49 // } 50 51 return boost::report_errors(); 52 } 53