[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.threads / thread.thread.class / thread.thread.id / cmp.pass.cpp
blob7be937aa948c50e263725103cf54a473a919002b
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 // UNSUPPORTED: no-threads
11 // <thread>
13 // class thread::id
15 // bool operator==(thread::id x, thread::id y) noexcept;
16 // bool operator!=(thread::id x, thread::id y) noexcept;
17 // bool operator< (thread::id x, thread::id y) noexcept;
18 // bool operator<=(thread::id x, thread::id y) noexcept;
19 // bool operator> (thread::id x, thread::id y) noexcept;
20 // bool operator>=(thread::id x, thread::id y) noexcept;
21 // strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
23 #include <thread>
24 #include <cassert>
26 #include "test_macros.h"
27 #include "test_comparisons.h"
29 int main(int, char**) {
30 AssertComparisonsAreNoexcept<std::thread::id>();
31 AssertComparisonsReturnBool<std::thread::id>();
32 #if TEST_STD_VER > 17
33 AssertOrderAreNoexcept<std::thread::id>();
34 AssertOrderReturn<std::strong_ordering, std::thread::id>();
35 #endif
37 std::thread::id id1;
38 std::thread::id id2;
39 std::thread::id id3 = std::this_thread::get_id();
41 // `id1` and `id2` should compare equal
42 assert(testComparisons(id1, id2, /*isEqual*/ true, /*isLess*/ false));
43 #if TEST_STD_VER > 17
44 assert(testOrder(id1, id2, std::strong_ordering::equal));
45 #endif
47 // Test `t1` and `t3` which are not equal
48 bool isLess = id1 < id3;
49 assert(testComparisons(id1, id3, /*isEqual*/ false, isLess));
50 #if TEST_STD_VER > 17
51 assert(testOrder(id1, id3, isLess ? std::strong_ordering::less : std::strong_ordering::greater));
52 #endif
54 // Regression tests for https://github.com/llvm/llvm-project/issues/56187
55 // libc++ previously declared the comparison operators as hidden friends
56 // which was non-conforming.
57 assert(std::operator==(id1, id2));
58 #if TEST_STD_VER <= 17
59 assert(!std::operator!=(id1, id2));
60 assert(!std::operator<(id1, id2));
61 assert(std::operator<=(id1, id2));
62 assert(!std::operator>(id1, id2));
63 assert(std::operator>=(id1, id2));
64 #else
65 assert(std::operator<=>(id1, id2) == std::strong_ordering::equal);
66 #endif
68 return 0;