]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/test/writing-test-ts/user-defined-types-logging-customization-points.cpp
1 // (C) Copyright Raffi Enficiaud 2017.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
9 //! Customization point for printing user defined types
10 // *****************************************************************************
12 #define BOOST_TEST_MODULE user type logger customization points
13 #include <boost/test/unit_test.hpp>
15 namespace printing_test
{
16 struct user_defined_type
{
19 user_defined_type(int value_
) : value(value_
)
22 bool operator==(int right
) const {
23 return right
== value
;
27 std::ostream
& boost_test_print_type(std::ostream
& ostr
, user_defined_type
const& right
) {
28 ostr
<< "** value of my type is " << right
.value
<< " **";
33 //using namespace printing_test;
35 BOOST_AUTO_TEST_CASE(test1
)
37 //using printing_test::user_defined_type;
38 printing_test::user_defined_type
t(10);
39 BOOST_CHECK_EQUAL(t
, 10);
40 #ifndef BOOST_TEST_MACRO_LIMITED_SUPPORT
43 BOOST_TEST_MESSAGE("Printing t: " << t
);
46 // on unary expressions as well
48 operator bool() const { return true; }
50 std::ostream
&boost_test_print_type(std::ostream
&o
, const s
&) {
51 return o
<< "printed-s";
54 BOOST_AUTO_TEST_CASE( test_logs
)
57 BOOST_TEST_MESSAGE("Printing s(): " << s());