File: lightweight_test_test3.cpp

package info (click to toggle)
boost1.74 1.74.0%2Bds1-21
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 463,588 kB
  • sloc: cpp: 3,338,117; xml: 131,293; python: 33,088; ansic: 14,292; asm: 4,038; sh: 3,353; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (147 lines) | stat: -rw-r--r-- 2,608 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
// Test for lightweight_test.hpp
//
// Copyright (c) 2014, 2018 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//

#include <boost/core/lightweight_test.hpp>
#include <boost/core/noncopyable.hpp>
#include <ostream>

// EQ

struct eq1: private boost::noncopyable {};
struct eq2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, eq1 const& )
{
    return os << "eq1()";
}

std::ostream& operator<<( std::ostream& os, eq2 const& )
{
    return os << "eq2()";
}

bool operator==( eq1 const&, eq2 const& )
{
    return true;
}

// NE

struct ne1: private boost::noncopyable {};
struct ne2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, ne1 const& )
{
    return os << "ne1()";
}

std::ostream& operator<<( std::ostream& os, ne2 const& )
{
    return os << "ne2()";
}

bool operator!=( ne1 const&, ne2 const& )
{
    return true;
}

// LT

struct lt1: private boost::noncopyable {};
struct lt2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, lt1 const& )
{
    return os << "lt1()";
}

std::ostream& operator<<( std::ostream& os, lt2 const& )
{
    return os << "lt2()";
}

bool operator<( lt1 const&, lt2 const& )
{
    return true;
}

// LE

struct le1: private boost::noncopyable {};
struct le2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, le1 const& )
{
    return os << "le1()";
}

std::ostream& operator<<( std::ostream& os, le2 const& )
{
    return os << "le2()";
}

bool operator<=( le1 const&, le2 const& )
{
    return true;
}

// GT

struct gt1: private boost::noncopyable {};
struct gt2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, gt1 const& )
{
    return os << "gt1()";
}

std::ostream& operator<<( std::ostream& os, gt2 const& )
{
    return os << "gt2()";
}

bool operator>( gt1 const&, gt2 const& )
{
    return true;
}

// GE

struct ge1: private boost::noncopyable {};
struct ge2: private boost::noncopyable {};

std::ostream& operator<<( std::ostream& os, ge1 const& )
{
    return os << "ge1()";
}

std::ostream& operator<<( std::ostream& os, ge2 const& )
{
    return os << "ge2()";
}

bool operator>=( ge1 const&, ge2 const& )
{
    return true;
}

//

int main()
{
    BOOST_TEST_EQ( eq1(), eq2() );
    BOOST_TEST_NE( ne1(), ne2() );
    BOOST_TEST_LT( lt1(), lt2() );
    BOOST_TEST_LE( le1(), le2() );
    BOOST_TEST_GT( gt1(), gt2() );
    BOOST_TEST_GE( ge1(), ge2() );

    return boost::report_errors();
}