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