]>
Commit | Line | Data |
---|---|---|
d1236680 | 1 | // { dg-do run } |
1e42d2f4 | 2 | // { dg-additional-options "-pthread" { target pthread } } |
71c54f8e | 3 | // { dg-require-effective-target c++11 } |
faa00511 | 4 | // { dg-require-gthreads "" } |
faa00511 | 5 | |
83ffe9cd | 6 | // Copyright (C) 2011-2023 Free Software Foundation, Inc. |
faa00511 JW |
7 | // |
8 | // This file is part of the GNU ISO C++ Library. This library is free | |
9 | // software; you can redistribute it and/or modify it under the | |
10 | // terms of the GNU General Public License as published by the | |
11 | // Free Software Foundation; either version 3, or (at your option) | |
12 | // any later version. | |
13 | ||
14 | // This library is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | ||
19 | // You should have received a copy of the GNU General Public License along | |
20 | // with this library; see the file COPYING3. If not see | |
21 | // <http://www.gnu.org/licenses/>. | |
22 | ||
23 | ||
24 | #include <future> | |
25 | #include <testsuite_hooks.h> | |
26 | ||
27 | void test01() | |
28 | { | |
faa00511 JW |
29 | using std::launch; |
30 | ||
31 | const launch none{}; | |
32 | const launch both = launch::async|launch::deferred; | |
33 | const launch all = ~none; | |
34 | ||
35 | VERIFY( (none & both) == none ); | |
36 | VERIFY( (none | both) == both ); | |
37 | VERIFY( (none ^ both) == both ); | |
38 | ||
39 | VERIFY( (none & all) == none ); | |
40 | VERIFY( (none | all) == all ); | |
41 | VERIFY( (none ^ all) == all ); | |
42 | ||
43 | VERIFY( (both & all) == both ); | |
44 | VERIFY( (both | all) == all ); | |
45 | VERIFY( (both ^ all) == ~both ); | |
46 | ||
47 | VERIFY( (none & launch::async) == none ); | |
48 | VERIFY( (none & launch::deferred) == none ); | |
49 | ||
50 | VERIFY( (none | launch::async) == launch::async ); | |
51 | VERIFY( (none | launch::deferred) == launch::deferred ); | |
52 | ||
53 | VERIFY( (none ^ launch::async) == launch::async ); | |
54 | VERIFY( (none ^ launch::deferred) == launch::deferred ); | |
55 | ||
56 | VERIFY( (none & none) == none ); | |
57 | VERIFY( (none | none) == none ); | |
58 | VERIFY( (none ^ none) == none ); | |
59 | ||
60 | VERIFY( (both & both) == both ); | |
61 | VERIFY( (both | both) == both ); | |
62 | VERIFY( (both ^ both) == none ); | |
63 | ||
64 | VERIFY( (all & all) == all ); | |
65 | VERIFY( (all | all) == all ); | |
66 | VERIFY( (all ^ all) == none ); | |
67 | ||
68 | launch l = none; | |
69 | ||
70 | l &= none; | |
71 | VERIFY( l == none ); | |
72 | l |= none; | |
73 | VERIFY( l == none ); | |
74 | l ^= none; | |
75 | VERIFY( l == none ); | |
76 | ||
77 | l &= both; | |
78 | VERIFY( l == none ); | |
79 | l |= both; | |
80 | VERIFY( l == both ); | |
81 | l ^= both; | |
82 | VERIFY( l == none ); | |
83 | } | |
84 | ||
85 | int main() | |
86 | { | |
87 | test01(); | |
88 | return 0; | |
89 | } |