]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/25_algorithms/copy_backward/deque_iterators/2.cc
1 // Copyright (C) 2019-2022 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
23 #include <testsuite_hooks.h>
30 for (int i
= 0; i
!= _GLIBCXX_STD_C::__deque_buf_size(sizeof(int)); ++i
)
33 deque
<int> dest(d
.size(), 0);
35 copy_backward(d
.begin(), d
.end(), dest
.end());
37 VERIFY( equal(dest
.begin(), dest
.end(), d
.begin()) );
45 for (int i
= 0; i
!= 4 * _GLIBCXX_STD_C::__deque_buf_size(sizeof(int)); ++i
)
48 deque
<int> dest(d
.size(), 0);
50 const deque
<int>& cd
= d
;
51 copy_backward(cd
.begin(), cd
.end(), dest
.end());
53 VERIFY( equal(dest
.begin(), dest
.end(), cd
.begin()) );
61 for (int i
= 0; i
!= 1024; ++i
)
67 std::vector
<int> dest(d
.size(), 0);
69 std::copy_backward(d
.begin(), d
.end(), dest
.end());
70 VERIFY( std::equal(dest
.begin(), dest
.end(), d
.begin()) );
78 for (int i
= 0; i
!= 1024; ++i
)
81 std::deque
<int> dest(v
.size() - 10, 0);
83 std::copy_backward(v
.begin() + 5, v
.end() - 5, dest
.end());
84 VERIFY( std::equal(v
.begin() + 5, v
.end() - 5, dest
.begin()) );
92 for (int i
= 0; i
!= 1024; ++i
)
95 std::deque
<int> dest(l
.size(), 0);
97 std::copy_backward(l
.begin(), l
.end(), dest
.end());
98 VERIFY( std::equal(dest
.begin(), dest
.end(), l
.begin()) );