[SandboxIR][Doc] Add Quick start notes (#123992)
[llvm-project.git] / libcxx / test / std / utilities / utility / operators / rel_ops.pass.cpp
blobdb0c7a61bddd63720fa50458fb489e957b385054
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 //===----------------------------------------------------------------------===//
9 // test rel_ops
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
13 #include <utility>
14 #include <cassert>
16 #include "test_macros.h"
18 struct A
20 int data_;
22 explicit A(int data = -1) : data_(data) {}
25 inline
26 bool
27 operator == (const A& x, const A& y)
29 return x.data_ == y.data_;
32 inline
33 bool
34 operator < (const A& x, const A& y)
36 return x.data_ < y.data_;
39 int main(int, char**)
41 using namespace std::rel_ops;
42 A a1(1);
43 A a2(2);
44 assert(a1 == a1);
45 assert(a1 != a2);
46 assert(a1 < a2);
47 assert(a2 > a1);
48 assert(a1 <= a1);
49 assert(a1 <= a2);
50 assert(a2 >= a2);
51 assert(a2 >= a1);
53 return 0;