[libc++][NFC] Add missing includes in tzdb.cpp
[llvm-project.git] / libcxx / test / std / thread / futures / futures.overview / launch.pass.cpp
blob37ad2ff4a8645f0aea1d2e9f2d57009596a58274
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 // <future>
13 // enum class launch
14 // {
15 // async = 1,
16 // deferred = 2,
17 // any = async | deferred /* EXTENSION */
18 // };
20 #include <future>
21 #include <cassert>
23 #include "test_macros.h"
25 int main(int, char**)
27 #if TEST_STD_VER < 11
28 LIBCPP_STATIC_ASSERT(static_cast<int>(std::launch::any) ==
29 (static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), "");
30 #else
31 LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async | std::launch::deferred), "");
32 static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), "");
33 LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async ^ std::launch::deferred), "");
34 LIBCPP_STATIC_ASSERT(std::launch::deferred == ~std::launch::async, "");
35 std::launch x = std::launch::async;
36 x &= std::launch::deferred;
37 assert(x == std::launch(0));
38 x = std::launch::async;
39 x |= std::launch::deferred;
40 LIBCPP_ASSERT(x == std::launch::any);
41 x ^= std::launch::deferred;
42 assert(x == std::launch::async);
43 #endif
44 static_assert(static_cast<int>(std::launch::async) == 1, "");
45 static_assert(static_cast<int>(std::launch::deferred) == 2, "");
47 return 0;