diff options
author | Chris Jefferson <chris@bubblescope.net> | 2007-10-03 17:27:18 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2007-10-03 17:27:18 +0000 |
commit | f5783e34f97cd9012ae3ee4118a5e3bf642d8aed (patch) | |
tree | 46cc3fffe09f0d59f370c379911fdc297f83f02b /libstdc++-v3/testsuite/25_algorithms/stable_partition | |
parent | 53f8671f979fce37896147392d9602559afe1f58 (diff) | |
download | gcc-f5783e34f97cd9012ae3ee4118a5e3bf642d8aed.zip gcc-f5783e34f97cd9012ae3ee4118a5e3bf642d8aed.tar.gz gcc-f5783e34f97cd9012ae3ee4118a5e3bf642d8aed.tar.bz2 |
moveable.cc: New.
2007-10-03 Chris Jefferson <chris@bubblescope.net>
Benjamin Kosnik <bkoz@redhat.com>
* testsuite/20_util/pair/moveable.cc: New. Merge from
libstdcxx_so_7-branch.
* testsuite/23_containers/deque/capacity/moveable.cc: Same.
* testsuite/23_containers/deque/cons/moveable.cc: Same.
* testsuite/23_containers/deque/modifiers/moveable.cc: Same.
* testsuite/23_containers/deque/moveable.cc: Same.
* testsuite/23_containers/list/moveable.cc: Same.
* testsuite/23_containers/map/moveable.cc: Same.
* testsuite/23_containers/multimap/moveable.cc: Same.
* testsuite/23_containers/multiset/moveable.cc: Same.
* testsuite/23_containers/set/moveable.cc: Same.
* testsuite/23_containers/vector/cons/moveable.cc: Same.
* testsuite/23_containers/vector/modifiers/moveable.cc: Same.
* testsuite/23_containers/vector/moveable.cc: Same.
* testsuite/23_containers/vector/resize/moveable.cc: Same.
* testsuite/25_algorithms/heap/moveable.cc: Same.
* testsuite/25_algorithms/nth_element/moveable.cc: Same.
* testsuite/25_algorithms/partial_sort/moveable.cc: Same.
* testsuite/25_algorithms/partition/moveable.cc: Same.
* testsuite/25_algorithms/remove_if/moveable.cc: Same.
* testsuite/25_algorithms/remove/moveable.cc: Same.
* testsuite/25_algorithms/reverse/moveable.cc: Same.
* testsuite/25_algorithms/rotate/moveable.cc: Same.
* testsuite/25_algorithms/sort/moveable.cc: Same.
* testsuite/25_algorithms/swap_ranges/moveable.cc: Same.
* testsuite/25_algorithms/unique/moveable.cc: Same.
* testsuite/util/testsuite_rvalref.h: New.
* testsuite/25_algorithms/equal/equal.cc: Move to...
* testsuite/25_algorithms/equal/no_operator_ne.cc: ...this.
* testsuite/25_algorithms/heap/heap.cc: Move to...
* testsuite/25_algorithms/heap/1.cc: ...this.
* testsuite/25_algorithms/lower_bound/lower_bound.cc: Move to...
* testsuite/25_algorithms/lower_bound/no_operator_ne.cc: ...this.
* testsuite/25_algorithms/partition/partition.cc: Move to...
* testsuite/25_algorithms/partition/1.cc: ...this.
* testsuite/25_algorithms/stable_partition/1.cc: ... and this.
* testsuite/25_algorithms/search/1.cc: Update from merge.
* testsuite/25_algorithms/search/check_type.cc: Same.
* testsuite/lib/dg-options.exp (dg-require-rvalref): New.
* testsuite/lib/libstdc++.exp (check_v3_target_rvalref): New.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r128990
Diffstat (limited to 'libstdc++-v3/testsuite/25_algorithms/stable_partition')
-rw-r--r-- | libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc b/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc new file mode 100644 index 0000000..29188f8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.2.12 [lib.alg.partitions] Partitions. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; +const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17}; +const int N = sizeof(A) / sizeof(int); + +struct Pred +{ + bool + operator()(const int& x) const + { return (x % 2) == 0; } +}; + +// 25.2.12 stable_partition() +void +test02() +{ + using std::stable_partition; + + int s1[N]; + std::copy(A, A + N, s1); + + stable_partition(s1, s1 + N, Pred()); + VERIFY(std::equal(s1, s1 + N, B)); +} + +int +main() +{ + test02(); + return 0; +} |