Imported Upstream version 1.64.0
[platform/upstream/boost.git] / 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)
5
6 //  See http://www.boost.org/libs/test for the library home page.
7 //
8 //! @file
9 //! Customization point for printing user defined types
10 // *****************************************************************************
11
12 #define BOOST_TEST_MODULE user type logger customization points
13 #include <boost/test/unit_test.hpp>
14
15 namespace printing_test {
16 struct user_defined_type {
17     int value;
18
19     user_defined_type(int value_) : value(value_)
20     {}
21
22     bool operator==(int right) const {
23         return right == value;
24     }
25 };
26
27 std::ostream& boost_test_print_type(std::ostream& ostr, user_defined_type const& right) {
28     ostr << "** value of my type is " << right.value << " **";
29     return ostr;
30 }
31 }
32
33 //using namespace printing_test;
34
35 BOOST_AUTO_TEST_CASE(test1)
36 {
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
41     BOOST_TEST(t == 10);
42 #endif
43 }