1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// test rel_ops
10
11#include <utility>
12#include <cassert>
13
14#include "test_macros.h"
15
16struct A
17{
18 int data_;
19
20 explicit A(int data = -1) : data_(data) {}
21};
22
23inline
24bool
25operator == (const A& x, const A& y)
26{
27 return x.data_ == y.data_;
28}
29
30inline
31bool
32operator < (const A& x, const A& y)
33{
34 return x.data_ < y.data_;
35}
36
37int main(int, char**)
38{
39 using namespace std::rel_ops;
40 A a1(1);
41 A a2(2);
42 assert(a1 == a1);
43 assert(a1 != a2);
44 assert(a1 < a2);
45 assert(a2 > a1);
46 assert(a1 <= a1);
47 assert(a1 <= a2);
48 assert(a2 >= a2);
49 assert(a2 >= a1);
50
51 return 0;
52}
53

source code of libcxx/test/std/utilities/utility/operators/rel_ops.pass.cpp