1//
2// Test for lightweight_test.hpp
3//
4// Copyright (c) 2014, 2018 Peter Dimov
5//
6// Distributed under the Boost Software License, Version 1.0.
7// See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt
9//
10
11#include <boost/core/lightweight_test.hpp>
12#include <boost/core/noncopyable.hpp>
13#include <ostream>
14
15// EQ
16
17struct eq1: private boost::noncopyable {};
18struct eq2: private boost::noncopyable {};
19
20std::ostream& operator<<( std::ostream& os, eq1 const& )
21{
22 return os << "eq1()";
23}
24
25std::ostream& operator<<( std::ostream& os, eq2 const& )
26{
27 return os << "eq2()";
28}
29
30bool operator==( eq1 const&, eq2 const& )
31{
32 return true;
33}
34
35// NE
36
37struct ne1: private boost::noncopyable {};
38struct ne2: private boost::noncopyable {};
39
40std::ostream& operator<<( std::ostream& os, ne1 const& )
41{
42 return os << "ne1()";
43}
44
45std::ostream& operator<<( std::ostream& os, ne2 const& )
46{
47 return os << "ne2()";
48}
49
50bool operator!=( ne1 const&, ne2 const& )
51{
52 return true;
53}
54
55// LT
56
57struct lt1: private boost::noncopyable {};
58struct lt2: private boost::noncopyable {};
59
60std::ostream& operator<<( std::ostream& os, lt1 const& )
61{
62 return os << "lt1()";
63}
64
65std::ostream& operator<<( std::ostream& os, lt2 const& )
66{
67 return os << "lt2()";
68}
69
70bool operator<( lt1 const&, lt2 const& )
71{
72 return true;
73}
74
75// LE
76
77struct le1: private boost::noncopyable {};
78struct le2: private boost::noncopyable {};
79
80std::ostream& operator<<( std::ostream& os, le1 const& )
81{
82 return os << "le1()";
83}
84
85std::ostream& operator<<( std::ostream& os, le2 const& )
86{
87 return os << "le2()";
88}
89
90bool operator<=( le1 const&, le2 const& )
91{
92 return true;
93}
94
95// GT
96
97struct gt1: private boost::noncopyable {};
98struct gt2: private boost::noncopyable {};
99
100std::ostream& operator<<( std::ostream& os, gt1 const& )
101{
102 return os << "gt1()";
103}
104
105std::ostream& operator<<( std::ostream& os, gt2 const& )
106{
107 return os << "gt2()";
108}
109
110bool operator>( gt1 const&, gt2 const& )
111{
112 return true;
113}
114
115// GE
116
117struct ge1: private boost::noncopyable {};
118struct ge2: private boost::noncopyable {};
119
120std::ostream& operator<<( std::ostream& os, ge1 const& )
121{
122 return os << "ge1()";
123}
124
125std::ostream& operator<<( std::ostream& os, ge2 const& )
126{
127 return os << "ge2()";
128}
129
130bool operator>=( ge1 const&, ge2 const& )
131{
132 return true;
133}
134
135//
136
137int main()
138{
139 BOOST_TEST_EQ( eq1(), eq2() );
140 BOOST_TEST_NE( ne1(), ne2() );
141 BOOST_TEST_LT( lt1(), lt2() );
142 BOOST_TEST_LE( le1(), le2() );
143 BOOST_TEST_GT( gt1(), gt2() );
144 BOOST_TEST_GE( ge1(), ge2() );
145
146 return boost::report_errors();
147}
148

source code of boost/libs/core/test/lightweight_test_test3.cpp