]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 25_algorithms / headers / algorithm / parallel_algorithm_mixed1.cc
CommitLineData
c2ba9709
JS
1// { dg-do compile }
2// { dg-require-parallel-mode "" }
3// { dg-options "-fopenmp" { target *-*-* } }
4
a945c346 5// Copyright (C) 2007-2024 Free Software Foundation, Inc.
c2ba9709
JS
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
748086b7 10// Free Software Foundation; either version 3, or (at your option)
c2ba9709
JS
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
748086b7
JJ
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
c2ba9709
JS
21
22#include <parallel/algorithm>
23#include <vector>
24#include <algorithm>
25
26void test()
27{
28 typedef unsigned short value_type;
29 typedef std::vector<value_type> vector_type;
30
31 const value_type c(0);
32
52fe3d5b
JS
33 vector_type v(10), result(20);
34
35 std::equal(v.begin(), v.end(), v.begin());
36 std::equal(v.begin(), v.end(), v.begin(), std::equal_to<value_type>());
37 __gnu_parallel::equal(v.begin(), v.end(), v.begin());
38 __gnu_parallel::equal(v.begin(), v.end(), v.begin(),
39 std::equal_to<value_type>());
40
c2ba9709
JS
41 std::find(v.begin(), v.end(), c);
42 __gnu_parallel::find(v.begin(), v.end(), c);
52fe3d5b
JS
43
44 std::find_first_of(v.begin(), v.end(), v.begin(), v.end());
45 std::find_first_of(v.begin(), v.end(), v.begin(), v.end(),
46 std::equal_to<value_type>());
47 __gnu_parallel::find_first_of(v.begin(), v.end(), v.begin(), v.end());
48 __gnu_parallel::find_first_of(v.begin(), v.end(), v.begin(), v.end(),
49 std::equal_to<value_type>());
50
51 std::search_n(v.begin(), v.end(), 5, value_type(1));
52 std::search_n(v.begin(), v.end(), 5, value_type(1),
53 std::equal_to<value_type>());
54 __gnu_parallel::search_n(v.begin(), v.end(), 5, value_type(1));
55 __gnu_parallel::search_n(v.begin(), v.end(), 5, value_type(1),
56 std::equal_to<value_type>());
57
58 std::merge(v.begin(), v.end(), v.begin(), v.end(), result.begin());
59 std::merge(v.begin(), v.end(), v.begin(), v.end(), result.begin(),
60 std::less<value_type>());
61 __gnu_parallel::merge(v.begin(), v.end(), v.begin(), v.end(),
62 result.begin());
63 __gnu_parallel::merge(v.begin(), v.end(), v.begin(), v.end(),
64 result.begin(), std::less<value_type>());
65
66 std::nth_element(v.begin(), v.begin() + 5, v.end());
67 std::nth_element(v.begin(), v.begin() + 5, v.end(), std::less<value_type>());
68 __gnu_parallel::nth_element(v.begin(), v.begin() + 5, v.end());
69 __gnu_parallel::nth_element(v.begin(), v.begin() + 5, v.end(),
70 std::less<value_type>());
71
72 std::partial_sort(v.begin(), v.begin() + 5, v.end());
73 std::partial_sort(v.begin(), v.begin() + 5, v.end(),
74 std::less<value_type>());
75 __gnu_parallel::partial_sort(v.begin(), v.begin() + 5, v.end());
76 __gnu_parallel::partial_sort(v.begin(), v.begin() + 5, v.end(),
77 std::less<value_type>());
78
79 std::min_element(v.begin(), v.end());
80 std::min_element(v.begin(), v.end(), std::less<value_type>());
81 __gnu_parallel::min_element(v.begin(), v.end());
82 __gnu_parallel::min_element(v.begin(), v.end(), std::less<value_type>());
83
84 std::max_element(v.begin(), v.end());
85 std::max_element(v.begin(), v.end(), std::less<value_type>());
86 __gnu_parallel::max_element(v.begin(), v.end());
87 __gnu_parallel::max_element(v.begin(), v.end(), std::less<value_type>());
c2ba9709 88}