aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2005-05-24 22:53:43 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2005-05-24 22:53:43 +0000
commit0e994557d37823b4646fc2ed62712046b3345f64 (patch)
tree6d9923668cd2aa984ee4820112915784284e282d /libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc
parent58393038d74a065fe2dd2980cf2e3e344f4f261b (diff)
downloadgcc-0e994557d37823b4646fc2ed62712046b3345f64.zip
gcc-0e994557d37823b4646fc2ed62712046b3345f64.tar.gz
gcc-0e994557d37823b4646fc2ed62712046b3345f64.tar.bz2
[multiple changes]
2005-05-24 Paolo Carlini <pcarlini@suse.de> * testsuite/25_algorithms/equal.cc: Move to... * testsuite/25_algorithms/equal: ... here. * testsuite/25_algorithms/lower_bound.cc: Move to... * testsuite/25_algorithms/lower_bound: ... here. 2005-05-24 Paolo Carlini <pcarlini@suse.de> Port from libstdcxx_so_7-branch: 2005-20-05 Chris Jefferson <chris@bubblescope.net> * testsuite/25_algorithms/heap.cc: Move to... * testsuite/25_algorithms/heap/heap.cc: ...here. * testsuite/25_algorithms/partition.cc: Move to... * testsuite/25_algorithms/partition/partition.cc: ...here. 2005-03-29 Christopher Jefferson <chris@bubblescope.net> * testsuite/25_algorithms/includes/1.cc: Add tests. * testsuite/25_algorithms/search/1.cc: Likewise. * testsuite/25_algorithms/unique_copy/1.cc: Likewise. * testsuite/25_algorithms/swap_ranges/1.cc: New. * testsuite/25_algorithms/swap_ranges/check_type.cc: New. * testsuite/25_algorithms/rotate.cc: Move to... * testsuite/25_algorithms/rotate/rotate.cc: ... here. * testsuite/25_algorithms/rotate/1.cc: New. * testsuite/25_algorithms/rotate/check_type.cc: New. * testsuite/25_algorithms/search_n/iterator.cc: Fix typo. 2005-03-14 Christopher Jefferson <chris@bubblescope.net> * include/bits/stl_algo.h (replace_copy, replace_copy_if): Don't assume that __new_value and *__first are convertible to each other. * testsuite/25_algorithms/find/1.cc: New. * testsuite/25_algorithms/find/check_type.cc: New. * testsuite/25_algorithms/find_if/1.cc: New. * testsuite/25_algorithms/find_if/check_type.cc: New. * testsuite/25_algorithms/replace/1.cc: New. * testsuite/25_algorithms/replace/check_type.cc: New. * testsuite/25_algorithms/replace_if/1.cc: New. * testsuite/25_algorithms/replace_if/check_type.cc: New. * testsuite/25_algorithms/replace_copy/1.cc: New. * testsuite/25_algorithms/replace_copy/check_type.cc: New. * testsuite/25_algorithms/replace_copy_if/1.cc: New. * testsuite/25_algorithms/replace_copy_if/check_type.cc: New. * testsuite/25_algorithms/remove/1.cc: New. * testsuite/25_algorithms/remove/check_type.cc: New. * testsuite/25_algorithms/remove_if/1.cc: New. * testsuite/25_algorithms/remove_if/check_type.cc: New. * testsuite/25_algorithms/count/1.cc: New. * testsuite/25_algorithms/count/check_type.cc: New. * testsuite/25_algorithms/count_if/1.cc: New. * testsuite/25_algorithms/count_if/check_type.cc: New. 2005-02-27 Christopher Jefferson <chris@bubblescope.net> Paolo Carlini <pcarlini@suse.de> * testsuite/ext/is_heap/check_type.cc: New. 2005-02-27 Paolo Carlini <pcarlini@suse.de> * testsuite/ext/is_heap/1.cc: New. 2005-02-01 Christopher Jefferson <chris@bubblescope.net> * testsuite/ext/median.cc: New. * testsuite/25_algorithms/adjacent_find/1.cc: New. * testsuite/25_algorithms/adjacent_find/check_type.cc: New. * testsuite/25_algorithms/search/1.cc: New. * testsuite/25_algorithms/search/check_type.cc: New. * testsuite/25_algorithms/unique_copy/1.cc: New. * testsuite/25_algorithms/unique_copy/check_type.cc: New. * testsuite/25_algorithms/partial_sort/1.cc: New. * testsuite/25_algorithms/partial_sort/check_type.cc: New. * testsuite/25_algorithms/partial_sort_copy/1.cc: New. * testsuite/25_algorithms/partial_sort_copy/check_type.cc: New. * testsuite/25_algorithms/lower_bound/1.cc: New. * testsuite/25_algorithms/lower_bound/check_type.cc: New. * testsuite/25_algorithms/upper_bound/1.cc: New. * testsuite/25_algorithms/upper_bound/check_type.cc: New. * testsuite/25_algorithms/merge/1.cc: New. * testsuite/25_algorithms/merge/check_type.cc: New. * testsuite/25_algorithms/inplace_merge/1.cc: New. * testsuite/25_algorithms/inplace_merge/check_type.cc: New. * testsuite/25_algorithms/stable_sort/1.cc: New. * testsuite/25_algorithms/stable_sort/check_type.cc: New. * testsuite/25_algorithms/nth_element/1.cc: New. * testsuite/25_algorithms/nth_element/check_type.cc: New. * testsuite/25_algorithms/equal_range/1.cc: New. * testsuite/25_algorithms/equal_range/check_type.cc: New. * testsuite/25_algorithms/binary_search/1.cc: New. * testsuite/25_algorithms/binary_search/check_type.cc: New. * testsuite/25_algorithms/includes/1.cc: New. * testsuite/25_algorithms/includes/check_type.cc: New. * testsuite/25_algorithms/set_union/1.cc: New. * testsuite/25_algorithms/set_union/check_type.cc: New. * testsuite/25_algorithms/set_intersection/1.cc: New. * testsuite/25_algorithms/set_intersection/check_type.cc: New. * testsuite/25_algorithms/set_difference/1.cc: New. * testsuite/25_algorithms/set_difference/check_type.cc: New. * testsuite/25_algorithms/set_symmetric_difference/1.cc: New. * testsuite/25_algorithms/set_symmetric_difference/check_type.cc: New. * testsuite/25_algorithms/min_element/1.cc: New. * testsuite/25_algorithms/min_element/check_type.cc: New. * testsuite/25_algorithms/max_element/1.cc: New. * testsuite/25_algorithms/max_element/check_type.cc: New. * testsuite/25_algorithms/prev_permutation/1.cc: New. * testsuite/25_algorithms/prev_permutation/check_type.cc: New. * testsuite/25_algorithms/next_permutation/1.cc: New. * testsuite/25_algorithms/next_permutation/check_type.cc: New. * testsuite/25_algorithms/find_first_of/1.cc: New. * testsuite/25_algorithms/find_first_of/check_type.cc: New. * testsuite/25_algorithms/find_end/1.cc: New. * testsuite/25_algorithms/find_end/check_type.cc: New. * testsuite/25_algorithms/equal/check_type.cc: Insert iterator type. * testsuite/25_algorithms/lexicographical_compare/check_type.cc: Likewise. 2005-01-10 Christopher Jefferson <chris@bubblescope.net> * testsuite/25_algorithms/lexicographical_compare/check_type.cc: New. * testsuite/25_algorithms/lexicographical_compare/1.cc: Likewise. * testsuite/25_algorithms/mismatch/check_type.cc: Likewise. * testsuite/25_algorithms/mismatch/1.cc: Likewise. * testsuite/25_algorithms/equal/check_type.cc: New. * testsuite/25_algorithms/equal/1.cc: New. From-SVN: r100127
Diffstat (limited to 'libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc')
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc
new file mode 100644
index 0000000..2c9c32d
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/1.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2005 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 even 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 25.2.4 replace_copy_if
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
+
+typedef test_container<int, input_iterator_wrapper> Icontainer;
+typedef test_container<int, output_iterator_wrapper> Ocontainer;
+int array[] = {0, 0, 0, 1, 0, 1};
+
+bool
+pred(int i)
+{ return i == 1; }
+
+void
+test1()
+{
+ int out[1];
+ Icontainer in_con(array, array);
+ Ocontainer out_con(out, out);
+ VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(),
+ out_con.begin(), pred, 1).ptr == out);
+}
+
+void
+test2()
+{
+ int out[1];
+ Icontainer in_con(array, array + 1);
+ Ocontainer out_con(out, out + 1);
+ VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(),
+ out_con.begin(), pred, 2).ptr == out + 1);
+ VERIFY(out[0] == 0);
+}
+
+void
+test3()
+{
+ int out[6];
+ Icontainer in_con(array, array + 6);
+ Ocontainer out_con(out, out + 6);
+ VERIFY(std::replace_copy_if(in_con.begin(), in_con.end(),
+ out_con.begin(), pred, 2).ptr == out + 6);
+ VERIFY(out[0] == 0 && out[1] == 0 && out[2] == 0 &&
+ out[3] == 2 && out[4] == 0 && out[5] == 2);
+}
+
+int
+main()
+{
+ test1();
+ test2();
+ test3();
+}