[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.stoptoken / stopsource / equals.pass.cpp
blobec22bbc88c1f07c77ef957a7f2f4f15097d423b1
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
10 // UNSUPPORTED: libcpp-has-no-experimental-stop_token
11 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // XFAIL: availability-synchronization_library-missing
14 // [[nodiscard]] bool operator==(const stop_source& lhs, const stop_source& rhs) noexcept;
15 // Returns: true if lhs and rhs have ownership of the same stop state or if both lhs and rhs do not have ownership of a stop state; otherwise false.
17 #include <cassert>
18 #include <concepts>
19 #include <stop_token>
20 #include <type_traits>
22 #include "test_macros.h"
24 template <class T>
25 concept IsNoThrowEqualityComparable = requires(const T& t1, const T& t2) {
26 { t1 == t2 } noexcept;
29 static_assert(IsNoThrowEqualityComparable<std::stop_source>);
31 int main(int, char**) {
32 // both no state
34 const std::stop_source ss1(std::nostopstate);
35 const std::stop_source ss2(std::nostopstate);
36 assert(ss1 == ss2);
37 assert(!(ss1 != ss2));
40 // only one has no state
42 const std::stop_source ss1(std::nostopstate);
43 const std::stop_source ss2;
44 assert(!(ss1 == ss2));
45 assert(ss1 != ss2);
48 // both has states. same state
50 const std::stop_source ss1;
51 const std::stop_source ss2(ss1);
52 assert(ss1 == ss2);
53 assert(!(ss1 != ss2));
56 // both has states. different states
58 const std::stop_source ss1;
59 const std::stop_source ss2;
60 assert(!(ss1 == ss2));
61 assert(ss1 != ss2);
64 return 0;