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 
9 #include <boost/spirit/include/karma_numeric.hpp>
10 #include <boost/spirit/include/karma_generate.hpp>
11 #include <boost/spirit/include/karma_operator.hpp>
12 #include <boost/spirit/include/karma_directive.hpp>
13 #include <boost/spirit/include/karma_char.hpp>
14 
15 #include <iostream>
16 #include "test.hpp"
17 
18 int
main()19 main()
20 {
21     using namespace spirit_test;
22     using namespace boost::spirit;
23 
24     {
25         using boost::spirit::karma::double_;
26         using boost::spirit::karma::buffer;
27 
28         std::vector<double> v;
29         BOOST_TEST(test("", -buffer['[' << +double_ << ']'], v));
30 
31         v.push_back(1.0);
32         v.push_back(2.0);
33         BOOST_TEST(test("[1.02.0]", buffer['[' << +double_ << ']'], v));
34         BOOST_TEST(test("[1.02.0]", buffer[buffer['[' << +double_ << ']']], v));
35     }
36 
37     {
38         using boost::spirit::karma::double_;
39         using boost::spirit::karma::buffer;
40         using boost::spirit::ascii::space;
41 
42         std::vector<double> v;
43         BOOST_TEST(test_delimited("",
44             -buffer['[' << +double_ << ']'], v, space));
45 
46         v.push_back(1.0);
47         v.push_back(2.0);
48         BOOST_TEST(test_delimited("[ 1.0 2.0 ] ",
49             buffer['[' << +double_ << ']'], v, space));
50     }
51 
52     return boost::report_errors();
53 }
54