]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_assert2.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 25_algorithms / headers / algorithm / parallel_algorithm_assert2.cc
1 // { dg-do run }
2 // { dg-require-parallel-mode "" }
3 // { dg-options "-fopenmp -D_GLIBCXX_PARALLEL" { target *-*-* } }
4
5 // Copyright (C) 2016-2019 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
12
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
21
22 #undef _GLIBCXX_DEBUG
23 #undef _GLIBCXX_ASSERTIONS
24 #undef _GLIBCXX_PARALLEL_ASSERTIONS
25 #define _GLIBCXX_PARALLEL_ASSERTIONS 1
26 #include <parallel/algorithm>
27 #include <testsuite_hooks.h>
28
29 void
30 test01()
31 {
32 // This should not be enabled without _GLIBCXX_ASSERTIONS:
33 __glibcxx_assert(false);
34 }
35
36 void
37 test02()
38 {
39 bool result = false;
40
41 // This should be enabled by _GLIBCXX_PARALLEL_ASSERTIONS:
42 _GLIBCXX_PARALLEL_ASSERT(result = true);
43 VERIFY(result);
44 }
45
46 int main()
47 {
48 test01();
49 test02();
50 }