]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/proto/test/display_expr.cpp
1 ///////////////////////////////////////////////////////////////////////////////
4 // Copyright 2010 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/proto/proto.hpp>
10 #include <boost/test/unit_test.hpp>
12 namespace mpl
= boost::mpl
;
13 namespace proto
= boost::proto
;
18 std::ostream
& operator<<( std::ostream
& out
, const A
& ) { return out
<< "this is A!"; }
22 void test_display_expr()
24 // https://svn.boost.org/trac/boost/ticket/4910
25 proto::terminal
<int>::type i
= {0};
28 std::stringstream sout
;
29 proto::display_expr(i
+ A(), sout
);
30 BOOST_CHECK_EQUAL(sout
.str(), std::string(
33 " , terminal(this is A!)\n"
38 std::stringstream sout
;
39 proto::display_expr(i
+ B(), sout
);
40 BOOST_CHECK_EQUAL(sout
.str(), std::string(
43 " , terminal(this is A!)\n"
48 std::stringstream sout
;
49 char const * Cname
= BOOST_SP_TYPEID(C
).name();
50 proto::display_expr(i
+ C(), sout
);
51 BOOST_CHECK_EQUAL(sout
.str(), std::string(
54 " , terminal(") + Cname
+ std::string(")\n"
59 using namespace boost::unit_test
;
60 ///////////////////////////////////////////////////////////////////////////////
61 // init_unit_test_suite
63 test_suite
* init_unit_test_suite( int argc
, char* argv
[] )
65 test_suite
*test
= BOOST_TEST_SUITE("test display_expr() function");
66 test
->add(BOOST_TEST_CASE(&test_display_expr
));