From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../testsuite/25_algorithms/unique_copy/1.cc | 84 +++++++++++++++++++++ .../testsuite/25_algorithms/unique_copy/2.cc | 85 ++++++++++++++++++++++ .../testsuite/25_algorithms/unique_copy/26133.cc | 50 +++++++++++++ .../25_algorithms/unique_copy/check_type.cc | 54 ++++++++++++++ .../requirements/explicit_instantiation/2.cc | 38 ++++++++++ .../requirements/explicit_instantiation/pod.cc | 37 ++++++++++ 6 files changed, 348 insertions(+) create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/1.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/2.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/26133.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc (limited to 'libstdc++-v3/testsuite/25_algorithms/unique_copy') diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/1.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/1.cc new file mode 100644 index 000000000..ca79b354c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/1.cc @@ -0,0 +1,84 @@ +// Copyright (C) 2005, 2006, 2009 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 3, 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 COPYING3. If not see +// . + +// 25.2.8 [lib.alg.unique] + +#include +#include +#include + +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_copy; + +typedef test_container Icontainer; +typedef test_container Fcontainer; +typedef test_container Ocontainer; + +int array1[] = {0, 0, 0, 1, 1, 1}; +int array2[2]; + +void +test1() +{ + 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() +{ + 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(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/2.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/2.cc new file mode 100644 index 000000000..f0879a4d1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/2.cc @@ -0,0 +1,85 @@ +// Copyright (C) 2006, 2007, 2009 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 3, 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 COPYING3. If not see +// . + +// 25.2.8 [lib.alg.unique] + +#include +#include +#include +#include + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::output_iterator_wrapper; +using std::unique_copy; +using std::equal_to; + +typedef test_container Fcontainer; +typedef test_container Ocontainer; + +int array1[] = {0, 0, 0, 1, 1, 1}; +int array2[2]; + +void +test1() +{ + bool test __attribute__((unused)) = true; + Fcontainer con1(array1, array1); + Ocontainer con2(array2, array2); + VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin()).ptr == array2 ); +} + +void +test2() +{ + bool test __attribute__((unused)) = true; + Fcontainer 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; + Fcontainer con1(array1, array1); + Ocontainer con2(array2, array2); + VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin(), + equal_to()).ptr == array2 ); +} + +void +test4() +{ + bool test __attribute__((unused)) = true; + Fcontainer con1(array1, array1 + 6); + Ocontainer con2(array2, array2 + 2); + VERIFY( unique_copy(con1.begin(), con1.end(), con2.begin(), + equal_to()).ptr == array2 + 2 ); + VERIFY( array2[0] == 0 && array2[1] == 1 ); +} + +int +main() +{ + test1(); + test2(); + test3(); + test4(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/26133.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/26133.cc new file mode 100644 index 000000000..009c1a3a9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/26133.cc @@ -0,0 +1,50 @@ +// Copyright (C) 2006, 2009 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 3, 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 COPYING3. If not see +// . + +#include +#include +#include +#include + +struct no_assign +{ + int const x; + no_assign() : x(23) { } + operator int() const { return x; } +}; + +// libstdc++/26133 +void test01() +{ + bool test __attribute__((unused)) = true; + std::ostringstream oss1, oss2; + + no_assign in[4]; + + std::unique_copy(in, in + 4, std::ostream_iterator(oss1, "\n")); + VERIFY( oss1.str() == "23\n" ); + + std::unique_copy(in, in + 4, std::ostream_iterator(oss2, "\n"), + std::equal_to()); + VERIFY( oss2.str() == "23\n" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc new file mode 100644 index 000000000..9b5342074 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc @@ -0,0 +1,54 @@ +// Copyright (C) 2005, 2009 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 3, 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 COPYING3. If not see +// . + +// 25.5.8 [lib.alg.unique_copy] + +// { dg-do compile } + +#include +#include + +using __gnu_test::input_iterator_wrapper; +using __gnu_test::output_iterator_wrapper; + +struct S1 { }; + +struct S2 +{ + S2(const S1&) {} +}; + +bool +operator==(const S1&, const S1&) {return true;} + +struct X1 { }; + +struct X2 +{ + X2(const X1&) {} +}; + +bool +predicate(const X1&, const X1&) {return true;} + +output_iterator_wrapper +test1(input_iterator_wrapper& s1, output_iterator_wrapper& s2) +{ return std::unique_copy(s1, s1, s2); } + +output_iterator_wrapper +test2(input_iterator_wrapper& x1, output_iterator_wrapper& x2) +{ return std::unique_copy(x1, x1, x2, predicate); } diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..1b2283ada --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,38 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see +// . + + +#include +#include +#include + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* in_iterator_type; + typedef value_type* out_iterator_type; + typedef std::less predicate_type; + + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type); + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..15508973a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,37 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* in_iterator_type; + typedef value_type* out_iterator_type; + typedef std::less predicate_type; + + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type); + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type, predicate_type); +} -- cgit v1.2.3