]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/karma/duplicate.cpp
1 // Copyright (c) 2001-2011 Hartmut Kaiser
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)
6 #include <boost/spirit/include/karma_duplicate.hpp>
8 #include <boost/spirit/include/karma.hpp>
13 using namespace spirit_test
;
17 using boost::spirit::karma::double_
;
18 using boost::spirit::karma::space
;
19 using boost::spirit::karma::duplicate
;
23 BOOST_TEST(test("2.02.0", duplicate
[double_
<< double_
], 2.0));
24 BOOST_TEST(test_delimited("2.0 2.0 ",
25 duplicate
[double_
<< double_
], 2.0, space
));
26 BOOST_TEST(test("2.02.02.0",
27 duplicate
[double_
<< double_
<< double_
], 2.0));
28 BOOST_TEST(test_delimited("2.0 2.0 2.0 ",
29 duplicate
[double_
<< double_
<< double_
], 2.0, space
));
32 // test for non-sequences
34 BOOST_TEST(test("2.02.0", duplicate
["2.0" << double_
], 2.0));
35 BOOST_TEST(test_delimited("2.0 2.0 ",
36 duplicate
["2.0" << double_
], 2.0, space
));
39 // test for subjects exposing no attribute
41 BOOST_TEST(test("2.02.0", duplicate
["2.0"] << double_
, 2.0));
42 BOOST_TEST(test_delimited("2.0 2.0 ",
43 duplicate
["2.0"] << double_
, 2.0, space
));
46 // test for attribute reporting
48 BOOST_TEST(test("bar", (duplicate
["bar"] | "foo")));
49 BOOST_TEST(test("2.0", (duplicate
[double_
] | "foo"), 2.0));
50 BOOST_TEST(test("2.02.0",
51 (duplicate
[double_
<< double_
] | "foo"), 2.0));
54 return boost::report_errors();