]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/25_algorithms/equal/deque_iterators/1.cc
1 // Copyright (C) 2019 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/>.
22 #include <ext/new_allocator.h>
23 #include <ext/malloc_allocator.h>
25 #include <testsuite_hooks.h>
32 for (int i
= 0; i
!= _GLIBCXX_STD_C::__deque_buf_size(sizeof(int)); ++i
)
35 const deque
<int>& cd
= d
;
37 VERIFY( equal(cd
.begin(), cd
.end(), cd
.begin()) );
38 VERIFY( equal(cd
.begin(), cd
.end(), d
.begin()) );
39 VERIFY( equal(d
.begin(), d
.end(), d
.begin()) );
40 VERIFY( equal(d
.begin(), d
.end(), cd
.begin()) );
48 for (int i
= 0; i
!= 1024; ++i
)
51 VERIFY( equal(d
.begin(), d
.begin() + 10, d
.begin() + 20) );
52 VERIFY( equal(d
.begin() + 10, d
.end() - 10, d
.begin()) );
54 const deque
<int>& cd
= d
;
56 VERIFY( equal(cd
.begin(), cd
.begin() + 10, cd
.begin() + 20) );
57 VERIFY( equal(cd
.begin() + 10, cd
.end() - 10, d
.begin()) );
58 VERIFY( equal(d
.begin() + 10, d
.end() - 10, cd
.begin()) );
66 for (int i
= 0; i
!= 1024; ++i
)
70 for (int i
= 0; i
!= 10; ++i
)
73 VERIFY( equal(d1
.begin(), d1
.begin() + 10, d2
.begin()) );
74 VERIFY( equal(d1
.begin() + 10, d1
.end() - 10, d2
.begin()) );
76 const deque
<int>& cd1
= d1
;
77 const deque
<int>& cd2
= d2
;
79 VERIFY( equal(cd1
.begin(), cd1
.begin() + 10, cd2
.begin() + 20) );
80 VERIFY( equal(cd1
.begin() + 10, cd1
.end() - 10, d2
.begin()) );
81 VERIFY( equal(cd2
.begin() + 10, cd2
.end() - 10, cd1
.begin()) );
89 for (int i
= 0; i
!= 1024; ++i
)
92 vector
<int> v(d
.begin(), d
.end());
94 VERIFY( equal(d
.begin(), d
.end(), v
.begin()) );
95 VERIFY( equal(v
.begin(), v
.end(), d
.begin()) );
97 const deque
<int>& cd
= d
;
99 VERIFY( equal(cd
.begin(), cd
.end(), v
.begin()) );
100 VERIFY( equal(v
.begin(), v
.end(), cd
.begin()) );
107 int a
[] { 0, 1, 2, 3, 4 };
108 deque
<int, __gnu_cxx::new_allocator
<int> > d1(a
, a
+ 5);
109 deque
<int, __gnu_cxx::malloc_allocator
<int> > d2(a
, a
+ 5);
111 VERIFY( equal(d1
.begin(), d1
.end(), d2
.begin()) );