gcc/testsuite/
[official-gcc.git] / libstdc++-v3 / testsuite / 30_threads / async / launch.cc
blobde4c45285cfa70b7a0353433f93b466e728263cf
1 // { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
2 // { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } }
3 // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
4 // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
5 // { dg-require-cstdint "" }
6 // { dg-require-gthreads "" }
7 // { dg-require-atomic-builtins "" }
9 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
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.
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.
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/>.
27 #include <future>
28 #include <testsuite_hooks.h>
30 void test01()
32 bool test __attribute__((unused)) = true;
34 using std::launch;
36 const launch none{};
37 const launch both = launch::async|launch::deferred;
38 const launch all = ~none;
40 VERIFY( (none & both) == none );
41 VERIFY( (none | both) == both );
42 VERIFY( (none ^ both) == both );
44 VERIFY( (none & all) == none );
45 VERIFY( (none | all) == all );
46 VERIFY( (none ^ all) == all );
48 VERIFY( (both & all) == both );
49 VERIFY( (both | all) == all );
50 VERIFY( (both ^ all) == ~both );
52 VERIFY( (none & launch::async) == none );
53 VERIFY( (none & launch::deferred) == none );
55 VERIFY( (none | launch::async) == launch::async );
56 VERIFY( (none | launch::deferred) == launch::deferred );
58 VERIFY( (none ^ launch::async) == launch::async );
59 VERIFY( (none ^ launch::deferred) == launch::deferred );
61 VERIFY( (none & none) == none );
62 VERIFY( (none | none) == none );
63 VERIFY( (none ^ none) == none );
65 VERIFY( (both & both) == both );
66 VERIFY( (both | both) == both );
67 VERIFY( (both ^ both) == none );
69 VERIFY( (all & all) == all );
70 VERIFY( (all | all) == all );
71 VERIFY( (all ^ all) == none );
73 launch l = none;
75 l &= none;
76 VERIFY( l == none );
77 l |= none;
78 VERIFY( l == none );
79 l ^= none;
80 VERIFY( l == none );
82 l &= both;
83 VERIFY( l == none );
84 l |= both;
85 VERIFY( l == both );
86 l ^= both;
87 VERIFY( l == none );
90 int main()
92 test01();
93 return 0;