OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [23_containers/] [list/] [cons/] [6.h] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
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
// Range assign
23
//
24
// This test verifies the following.
25
// 23.2.2.1     void assign(InputIterator f, InputIterator l)
26
// 23.2.2       const_iterator begin() const
27
// 23.2.2       const_iterator end() const
28
// 23.2.2       size_type size() const
29
//
30
template<typename _Tp>
31
void
32
cons06()
33
{
34
  bool test __attribute__((unused)) = true;
35
  const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
36
  const int B[] = {101, 102, 103, 104, 105};
37
  const std::size_t N = sizeof(A) / sizeof(int);
38
  const std::size_t M = sizeof(B) / sizeof(int);
39
  std::size_t count;
40
 
41
  typedef _Tp list_type;
42
  typedef typename list_type::const_iterator const_iterator;
43
  const_iterator i;
44
 
45
  list_type list0501;
46
 
47
  // make it bigger
48
  list0501.assign(A, A + N);
49
  for (i = list0501.begin(), count = 0;
50
       i != list0501.end();
51
       ++i, ++count)
52
    VERIFY(*i == A[count]);
53
  VERIFY(count == N);
54
  VERIFY(list0501.size() == N);
55
 
56
  // make it smaller
57
  list0501.assign(B, B + M);
58
  for (i = list0501.begin(), count = 0;
59
       i != list0501.end();
60
       ++i, ++count)
61
    VERIFY(*i == B[count]);
62
  VERIFY(count == M);
63
  VERIFY(list0501.size() == M);
64
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.