]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/23_containers/list/cons/9.h
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 23_containers / list / cons / 9.h
CommitLineData
f1717362 1// Copyright (C) 2001-2016 Free Software Foundation, Inc.
2b3fc9df 2//
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)
7// any later version.
8
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.
13
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/>.
17
18// 23.2.2.1 list constructors, copy, and assignment
19
20#include <testsuite_hooks.h>
21
22// Assignment operator
23//
24// This test verifies the following.
25// 23.2.2 operator=(const list& x)
26// 23.2.2 iterator begin()
27// 23.2.2 iterator end()
28// 23.2.2 size_type size() const
29// 23.2.2 bool operator==(const list& x, const list& y)
30//
31template<typename _Tp>
32void
33cons09()
34{
35 bool test __attribute__((unused)) = true;
36 typedef _Tp list_type;
37 typedef typename list_type::iterator iterator;
38
39 const int A[] = {701, 702, 703, 704, 705};
40 const std::size_t N = sizeof(A) / sizeof(int);
41 std::size_t count;
42
43 iterator i;
44
45 list_type list0701(A, A + N);
46 VERIFY(list0701.size() == N);
47
48 list_type list0702;
49 VERIFY(list0702.size() == 0);
50
51 list0702 = list0701;
52 VERIFY(list0702.size() == N);
53 for (i = list0702.begin(), count = 0;
54 i != list0702.end();
55 ++i, ++count)
56 VERIFY(*i == A[count]);
57 VERIFY(count == N);
58 VERIFY(list0702 == list0701);
59}