This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++-v3 testsuite patch
- From: Chris Jefferson <caj at cs dot york dot ac dot uk>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 Mar 2005 22:41:00 +0000
- Subject: libstdc++-v3 testsuite patch
A hopefully entirely non-exciting libstdc++-v3 testsuite patch, which
adds another couple of functions, extends some previous ones to improve
coverage, and also fixes a bug in search_n's test.
2005-03-25 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.
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/includes/1.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/includes/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/includes/1.cc 2005-02-01 11:10:18.000000000 +0000
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/includes/1.cc 2005-03-25 20:20:00.000000000 +0000
@@ -31,6 +31,7 @@
void
test1()
{
+ bool test __attribute__((unused)) = true;
int array[] = {0};
Container con1(array, array);
Container con2(array, array);
@@ -40,6 +41,7 @@
void
test2()
{
+ bool test __attribute__((unused)) = true;
int array[] = {0, 1};
Container con1(array, array);
Container con2(array, array + 2);
@@ -49,15 +51,40 @@
void
test3()
{
+ bool test __attribute__((unused)) = true;
int array[] = {0, 1};
Container con1(array, array + 2);
Container con2(array, array);
VERIFY(includes(con1.begin(), con1.end(), con2.begin(), con2.end()));
}
+void
+test4()
+{
+ bool test __attribute__((unused)) = true;
+ int array1[] = {1, 2, 3, 4, 6, 8, 9};
+ int array2[] = {2, 4, 6, 8};
+ Container con1(array1, array1 + 7);
+ Container con2(array2, array2 + 4);
+ VERIFY(includes(con1.begin(), con1.end(), con2.begin(), con2.end()));
+}
+
+void
+test5()
+{
+ bool test __attribute__((unused)) = true;
+ int array1[] = {1, 2, 3, 5};
+ int array2[] = {2, 4, 6, 8};
+ Container con1(array1, array1 + 4);
+ Container con2(array2, array2 + 4);
+ VERIFY(!includes(con1.begin(), con1.end(), con2.begin(), con2.end()));
+}
+
int main()
{
test1();
test2();
test3();
+ test4();
+ test5();
}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/1.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/1.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/1.cc 2005-03-25 20:26:12.000000000 +0000
@@ -0,0 +1,126 @@
+// 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.10 rotate
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::bidirectional_iterator_wrapper;
+using __gnu_test::random_access_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Fcontainer;
+typedef test_container<int, bidirectional_iterator_wrapper> Bcontainer;
+typedef test_container<int, random_access_iterator_wrapper> Rcontainer;
+
+
+
+void
+test1()
+{
+ bool test __attribute__((unused)) = true;
+ int array[]={1};
+ Fcontainer fcon(array, array);
+ Bcontainer bcon(array, array);
+ Rcontainer rcon(array, array);
+ std::rotate(fcon.begin(), fcon.begin(), fcon.end());
+ std::rotate(bcon.begin(), bcon.begin(), bcon.end());
+ std::rotate(rcon.begin(), rcon.begin(), rcon.end());
+}
+
+void
+test2()
+{
+ bool test __attribute__((unused)) = true;
+ int array[] = {1};
+ Fcontainer fcon(array, array + 1);
+ Bcontainer bcon(array, array + 1);
+ Rcontainer rcon(array, array + 1);
+ std::rotate(fcon.begin(), fcon.begin(), fcon.end());
+ std::rotate(bcon.begin(), bcon.begin(), bcon.end());
+ std::rotate(rcon.begin(), rcon.begin(), rcon.end());
+ std::rotate(fcon.begin(), fcon.end(), fcon.end());
+ std::rotate(bcon.begin(), bcon.end(), bcon.end());
+ std::rotate(rcon.begin(), rcon.end(), rcon.end());
+}
+
+void
+test3()
+{
+ bool test __attribute__((unused)) = true;
+ int array[] = {1, 2, 3, 4, 5};
+ Fcontainer fcon(array, array + 5);
+ Bcontainer bcon(array, array + 5);
+ Rcontainer rcon(array, array + 5);
+ std::rotate(fcon.begin(), fcon.it(2), fcon.end());
+ VERIFY(array[0] == 3 && array[1] == 4 && array[2] == 5 &&
+ array[3] == 1 && array[4] == 2);
+ std::rotate(bcon.begin(), bcon.it(2), bcon.end());
+ VERIFY(array[0] == 5 && array[1] == 1 && array[2] == 2 &&
+ array[3] == 3 && array[4] == 4);
+ std::rotate(rcon.begin(), rcon.it(2), rcon.end());
+ VERIFY(array[0] == 2 && array[1] == 3 && array[2] == 4 &&
+ array[3] == 5 && array[4] == 1);
+}
+
+void
+test4()
+{
+ bool test __attribute__((unused)) = true;
+ int array[] = {1, 2, 3, 4};
+ Fcontainer fcon(array, array + 4);
+ Bcontainer bcon(array, array + 4);
+ Rcontainer rcon(array, array + 4);
+
+ std::rotate(fcon.begin(), fcon.it(3), fcon.end());
+ VERIFY(array[0] == 4 && array[1] == 1 && array[2] == 2 &&
+ array[3] == 3);
+
+ std::rotate(bcon.begin(), bcon.it(3), bcon.end());
+ VERIFY(array[0] == 3 && array[1] == 4 && array[2] == 1 &&
+ array[3] == 2);
+
+ std::rotate(rcon.begin(), rcon.it(3), rcon.end());
+ VERIFY(array[0] == 2 && array[1] == 3 && array[2] == 4 &&
+ array[3] == 1);
+
+}
+
+void
+test5()
+{
+ bool test __attribute__((unused)) = true;
+ int array[] = {1, 2, 3, 4};
+ Rcontainer con(array, array + 4);
+ std::rotate(con.begin(), con.it(2), con.end());
+ VERIFY(array[0] == 3 && array[1] == 4 && array[2] == 1 &&
+ array[3] == 2);
+}
+
+int
+main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/check_type.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/check_type.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/check_type.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/check_type.cc 2005-03-20 14:08:22.000000000 +0000
@@ -0,0 +1,48 @@
+// 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.10 Rotate
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+struct X { };
+
+bool operator<(X,X) { return true;}
+
+void
+test1(__gnu_test::forward_iterator_wrapper<X>& begin,
+ __gnu_test::forward_iterator_wrapper<X>& middle,
+ __gnu_test::forward_iterator_wrapper<X>& end)
+{ return std::rotate(begin,middle,end); }
+
+void
+test1(__gnu_test::bidirectional_iterator_wrapper<X>& begin,
+ __gnu_test::bidirectional_iterator_wrapper<X>& middle,
+ __gnu_test::bidirectional_iterator_wrapper<X>& end)
+{ return std::rotate(begin,middle,end); }
+
+void
+test1(__gnu_test::random_access_iterator_wrapper<X>& begin,
+ __gnu_test::random_access_iterator_wrapper<X>& middle,
+ __gnu_test::random_access_iterator_wrapper<X>& end)
+{ return std::rotate(begin,middle,end); }
+
+
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/rotate.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/rotate.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate/rotate.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate/rotate.cc 2004-03-04 18:11:06.000000000 +0000
@@ -0,0 +1,85 @@
+// Copyright (C) 2001, 2004 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.?? algorithms, rotate()
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <list>
+
+bool test __attribute__((unused)) = true;
+
+int A[] = {1, 2, 3, 4, 5, 6, 7};
+int B[] = {2, 3, 4, 5, 6, 7, 1};
+int C[] = {1, 2, 3, 4, 5, 6, 7};
+int D[] = {5, 6, 7, 1, 2, 3, 4};
+const int N = sizeof(A) / sizeof(int);
+
+/* need a test for a forward iterator -- can't think of one that makes sense */
+
+/* biderectional iterator */
+void
+test02()
+{
+ using std::rotate;
+ typedef std::list<int> Container;
+
+ Container a(A, A + N);
+ VERIFY(std::equal(a.begin(), a.end(), A));
+
+ Container::iterator i = a.begin();
+ rotate(a.begin(), ++i, a.end());
+ VERIFY(std::equal(a.begin(), a.end(), B));
+
+ i = a.end();
+ rotate(a.begin(), --i, a.end());
+ VERIFY(std::equal(a.begin(), a.end(), C));
+
+ i = a.begin();
+ std::advance(i, 3);
+ rotate(a.begin(), ++i, a.end());
+ VERIFY(std::equal(a.begin(), a.end(), D));
+}
+
+/* random iterator */
+void
+test03()
+{
+ using std::rotate;
+ rotate(A, A + 1, A + N);
+ VERIFY(std::equal(A, A + N, B));
+
+ rotate(A, A + N - 1, A + N);
+ VERIFY(std::equal(A, A + N, C));
+
+ rotate(A, A + 4, A + N);
+ VERIFY(std::equal(A, A + N, D));
+}
+
+#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
+// Explicitly instantiate for systems with no COMDAT or weak support.
+template class __gnu_cxx::__mt_alloc<std::_List_node<int> >;
+#endif
+
+int
+main()
+{
+ test02();
+ test03();
+ return 0;
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/rotate.cc 2005-03-25 21:25:11.000000000 +0000
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/rotate.cc 1970-01-01 01:00:00.000000000 +0100
@@ -1,80 +0,0 @@
-// Copyright (C) 2001, 2004, 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.?? algorithms, rotate()
-
-#include <algorithm>
-#include <testsuite_hooks.h>
-#include <list>
-
-bool test __attribute__((unused)) = true;
-
-int A[] = {1, 2, 3, 4, 5, 6, 7};
-int B[] = {2, 3, 4, 5, 6, 7, 1};
-int C[] = {1, 2, 3, 4, 5, 6, 7};
-int D[] = {5, 6, 7, 1, 2, 3, 4};
-const int N = sizeof(A) / sizeof(int);
-
-/* need a test for a forward iterator -- can't think of one that makes sense */
-
-/* biderectional iterator */
-void
-test02()
-{
- using std::rotate;
- typedef std::list<int> Container;
-
- Container a(A, A + N);
- VERIFY(std::equal(a.begin(), a.end(), A));
-
- Container::iterator i = a.begin();
- rotate(a.begin(), ++i, a.end());
- VERIFY(std::equal(a.begin(), a.end(), B));
-
- i = a.end();
- rotate(a.begin(), --i, a.end());
- VERIFY(std::equal(a.begin(), a.end(), C));
-
- i = a.begin();
- std::advance(i, 3);
- rotate(a.begin(), ++i, a.end());
- VERIFY(std::equal(a.begin(), a.end(), D));
-}
-
-/* random iterator */
-void
-test03()
-{
- using std::rotate;
- rotate(A, A + 1, A + N);
- VERIFY(std::equal(A, A + N, B));
-
- rotate(A, A + N - 1, A + N);
- VERIFY(std::equal(A, A + N, C));
-
- rotate(A, A + 4, A + N);
- VERIFY(std::equal(A, A + N, D));
-}
-
-int
-main()
-{
- test02();
- test03();
- return 0;
-}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/search/1.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/search/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/search/1.cc 2005-02-01 11:10:27.000000000 +0000
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/search/1.cc 2005-03-25 20:23:40.000000000 +0000
@@ -33,6 +33,7 @@
void
test1()
{
+ bool test __attribute__((unused)) = true;
Container con1(array1, array1);
Container con2(array1, array1 + 1);
VERIFY(search(con1.begin(), con1.end(), con2.begin(), con2.end()).ptr == array1);
@@ -42,6 +43,7 @@
void
test2()
{
+ bool test __attribute__((unused)) = true;
Container con1(array1, array1 + 3);
Container con2(array2, array2 + 3);
VERIFY(search(con1.begin(), con1.end(), con2.begin(), con2.end()).ptr
@@ -51,16 +53,61 @@
void
test3()
{
+ bool test __attribute__((unused)) = true;
Container con1(array1 + 3, array1 + 10);
Container con2(array2, array2 + 3);
VERIFY(search(con1.begin(), con1.end(), con2.begin(), con2.end()).ptr
== array1 + 10);
}
+void
+test4()
+{
+ bool test __attribute__((unused)) = true;
+ Container con1(array1, array1 + 10);
+ Container con2(array2, array2 + 1);
+ VERIFY(search(con1.begin(), con1.end(), con2.begin(), con2.end()).ptr
+ == array1);
+}
+
+void
+test5()
+{
+ bool test __attribute__((unused)) = true;
+ Container con1(array1 + 6, array1 + 10);
+ Container con2(array2, array2 + 1);
+ VERIFY(search(con1.begin(), con1.end(), con2.begin(), con2.end()).ptr
+ == array1 + 10);
+}
+
+void
+test6()
+{
+ bool test __attribute__((unused)) = true;
+ int array3[]={2, 2, 1, 2, 3, 5};
+ int array4[]={1, 2, 3, 4};
+ Container con1(array3, array3 + 3);
+ Container con2(array3, array3 + 4);
+ Container con3(array3, array3 + 5);
+ Container con4(array3, array3 + 6);
+ Container endcon(array4, array4 + 4);
+ VERIFY(search(con1.begin(), con1.end(), endcon.begin(), endcon.end()).ptr
+ == array3 + 3);
+ VERIFY(search(con2.begin(), con2.end(), endcon.begin(), endcon.end()).ptr
+ == array3 + 4);
+ VERIFY(search(con3.begin(), con3.end(), endcon.begin(), endcon.end()).ptr
+ == array3 + 5);
+ VERIFY(search(con4.begin(), con4.end(), endcon.begin(), endcon.end()).ptr
+ == array3 + 6);
+}
+
int
main()
{
test1();
test2();
test3();
+ test4();
+ test5();
+ test6();
}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/search_n/iterator.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/search_n/iterator.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/search_n/iterator.cc 2004-12-06 11:13:17.000000000 +0000
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/search_n/iterator.cc 2005-03-25 22:32:30.924421424 +0000
@@ -76,7 +76,7 @@
{
test_container<int, forward_iterator_wrapper>
forwardcon(array2, array2 + i);
- test_container<int, bidirectional_iterator_wrapper>
+ test_container<int, random_access_iterator_wrapper>
randomcon(array2, array2 + i);
test_container<int, bidirectional_iterator_wrapper>
bidircon(array2, array2 + i);
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/1.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/swap_ranges/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/1.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/swap_ranges/1.cc 2005-03-25 22:04:10.584912320 +0000
@@ -0,0 +1,60 @@
+// 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.2 swap_ranges
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_iterators.h>
+
+using __gnu_test::test_container;
+using __gnu_test::forward_iterator_wrapper;
+
+typedef test_container<int, forward_iterator_wrapper> Container;
+
+
+void
+test1()
+{
+ bool test __attribute__((unused)) = true;
+ int array1[]={1, 2};
+ int array2[]={3, 4};
+ Container con1(array1, array1 + 2);
+ Container con2(array2, array2 + 2);
+ VERIFY(std::swap_ranges(con1.begin(), con1.end(), con2.begin()).ptr ==
+ array2 + 2);
+ VERIFY(array1[0] == 3 && array1[1] == 4 && array2[0] == 1 && array2[1] == 2);
+}
+
+void
+test2()
+{
+ bool test __attribute__((unused)) = true;
+ int array1[] = {1};
+ int array2[] = {1};
+ Container con1(array1, array1);
+ Container con2(array2, array2);
+ VERIFY(swap_ranges(con1.begin(), con1.end(), con2.begin()).ptr == array2);
+}
+
+int
+main()
+{
+ test1();
+ test2();
+}
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/check_type.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/swap_ranges/check_type.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/swap_ranges/check_type.cc 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/swap_ranges/check_type.cc 2005-03-25 22:26:39.202891224 +0000
@@ -0,0 +1,41 @@
+// 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 Swap Ranges
+
+// { dg-do compile }
+
+#include <algorithm>
+#include <testsuite_iterators.h>
+
+using __gnu_test::forward_iterator_wrapper;
+
+class X {
+X();
+X(const X&);
+void operator=(const X&);
+};
+
+void
+swap(X&, X&) { }
+
+void
+test1(forward_iterator_wrapper<X>& begin,
+ forward_iterator_wrapper<X>& end,
+ forward_iterator_wrapper<X>& begin2)
+{ std::swap_ranges(begin, end, begin2); }
diff -urN -x '*CVS*' libstdc++-v3.so_7.clean/testsuite/25_algorithms/unique_copy/1.cc libstdc++-v3.so_7.movesym/testsuite/25_algorithms/unique_copy/1.cc
--- libstdc++-v3.so_7.clean/testsuite/25_algorithms/unique_copy/1.cc 2005-02-01 11:10:35.000000000 +0000
+++ libstdc++-v3.so_7.movesym/testsuite/25_algorithms/unique_copy/1.cc 2005-03-25 20:22:25.000000000 +0000
@@ -23,32 +23,63 @@
#include <testsuite_iterators.h>
using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
using __gnu_test::forward_iterator_wrapper;
+using __gnu_test::output_iterator_wrapper;
using std::unique;
-typedef test_container<int, forward_iterator_wrapper> Container;
+typedef test_container<int, input_iterator_wrapper> Icontainer;
+typedef test_container<int, forward_iterator_wrapper> Fcontainer;
+typedef test_container<int, output_iterator_wrapper> Ocontainer;
+
int array1[] = {0, 0, 0, 1, 1, 1};
int array2[2];
void
test1()
{
- Container con1(array1, array1);
- Container con2(array2, array2);
+ bool test __attribute__((unused)) = true;
+ Icontainer con1(array1, array1);
+ Ocontainer con2(array2, array2);
VERIFY(unique_copy(con1.begin(), con1.end(), con2.begin()).ptr == array2);
}
void
test2()
-{
- Container con1(array1, array1 + 6);
- Container con2(array2, array2 + 2);
+{
+ bool test __attribute__((unused)) = true;
+ Icontainer con1(array1, array1 + 6);
+ Ocontainer con2(array2, array2 + 2);
VERIFY(unique_copy(con1.begin(), con1.end(), con2.begin()).ptr
== array2 + 2);
+ VERIFY(array2[0] == 0 && array2[1] == 1);
+}
+
+void
+test3()
+{
+ bool test __attribute__((unused)) = true;
+ Icontainer con1(array1, array1);
+ Fcontainer con2(array2, array2);
+ VERIFY(unique_copy(con1.begin(), con1.end(), con2.begin()).ptr == array2);
+}
+
+void
+test4()
+{
+ bool test __attribute__((unused)) = true;
+ Icontainer con1(array1, array1 + 6);
+ Fcontainer con2(array2, array2 + 2);
+ VERIFY(unique_copy(con1.begin(), con1.end(), con2.begin()).ptr
+ == array2 + 2);
+ VERIFY(array2[0] == 0 && array2[1] == 1);
}
int
main()
{
test1();
+ test2();
+ test3();
+ test4();
}