| 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 | |
| 17 | struct eq1: private boost::noncopyable {}; |
| 18 | struct eq2: private boost::noncopyable {}; |
| 19 | |
| 20 | std::ostream& operator<<( std::ostream& os, eq1 const& ) |
| 21 | { |
| 22 | return os << "eq1()" ; |
| 23 | } |
| 24 | |
| 25 | std::ostream& operator<<( std::ostream& os, eq2 const& ) |
| 26 | { |
| 27 | return os << "eq2()" ; |
| 28 | } |
| 29 | |
| 30 | bool operator==( eq1 const&, eq2 const& ) |
| 31 | { |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | // NE |
| 36 | |
| 37 | struct ne1: private boost::noncopyable {}; |
| 38 | struct ne2: private boost::noncopyable {}; |
| 39 | |
| 40 | std::ostream& operator<<( std::ostream& os, ne1 const& ) |
| 41 | { |
| 42 | return os << "ne1()" ; |
| 43 | } |
| 44 | |
| 45 | std::ostream& operator<<( std::ostream& os, ne2 const& ) |
| 46 | { |
| 47 | return os << "ne2()" ; |
| 48 | } |
| 49 | |
| 50 | bool operator!=( ne1 const&, ne2 const& ) |
| 51 | { |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | // LT |
| 56 | |
| 57 | struct lt1: private boost::noncopyable {}; |
| 58 | struct lt2: private boost::noncopyable {}; |
| 59 | |
| 60 | std::ostream& operator<<( std::ostream& os, lt1 const& ) |
| 61 | { |
| 62 | return os << "lt1()" ; |
| 63 | } |
| 64 | |
| 65 | std::ostream& operator<<( std::ostream& os, lt2 const& ) |
| 66 | { |
| 67 | return os << "lt2()" ; |
| 68 | } |
| 69 | |
| 70 | bool operator<( lt1 const&, lt2 const& ) |
| 71 | { |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | // LE |
| 76 | |
| 77 | struct le1: private boost::noncopyable {}; |
| 78 | struct le2: private boost::noncopyable {}; |
| 79 | |
| 80 | std::ostream& operator<<( std::ostream& os, le1 const& ) |
| 81 | { |
| 82 | return os << "le1()" ; |
| 83 | } |
| 84 | |
| 85 | std::ostream& operator<<( std::ostream& os, le2 const& ) |
| 86 | { |
| 87 | return os << "le2()" ; |
| 88 | } |
| 89 | |
| 90 | bool operator<=( le1 const&, le2 const& ) |
| 91 | { |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | // GT |
| 96 | |
| 97 | struct gt1: private boost::noncopyable {}; |
| 98 | struct gt2: private boost::noncopyable {}; |
| 99 | |
| 100 | std::ostream& operator<<( std::ostream& os, gt1 const& ) |
| 101 | { |
| 102 | return os << "gt1()" ; |
| 103 | } |
| 104 | |
| 105 | std::ostream& operator<<( std::ostream& os, gt2 const& ) |
| 106 | { |
| 107 | return os << "gt2()" ; |
| 108 | } |
| 109 | |
| 110 | bool operator>( gt1 const&, gt2 const& ) |
| 111 | { |
| 112 | return true; |
| 113 | } |
| 114 | |
| 115 | // GE |
| 116 | |
| 117 | struct ge1: private boost::noncopyable {}; |
| 118 | struct ge2: private boost::noncopyable {}; |
| 119 | |
| 120 | std::ostream& operator<<( std::ostream& os, ge1 const& ) |
| 121 | { |
| 122 | return os << "ge1()" ; |
| 123 | } |
| 124 | |
| 125 | std::ostream& operator<<( std::ostream& os, ge2 const& ) |
| 126 | { |
| 127 | return os << "ge2()" ; |
| 128 | } |
| 129 | |
| 130 | bool operator>=( ge1 const&, ge2 const& ) |
| 131 | { |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | // |
| 136 | |
| 137 | int 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 | |