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