OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc3/] [libstdc++-v3/] [testsuite/] [23_containers/] [list/] [cons/] [2.h] - Blame information for rev 516

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 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
// A nontrivial type.
23
template<typename T>
24
  struct A { };
25
 
26
// Another nontrivial type
27
struct B { };
28
 
29
// Fill constructor
30
//
31
// This test verifies the following.
32
// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
33
// 23.2.2   const_iterator begin() const
34
// 23.2.2   const_iterator end() const
35
// 23.2.2   size_type size() const
36
//
37
template<typename _Tp>
38
void
39
cons021()
40
{
41
  bool test __attribute__((unused)) = true;
42
  const std::size_t LIST_SIZE = 5;
43
  const int INIT_VALUE = 7;
44
  std::size_t count;
45
 
46
  typedef _Tp list_type;
47
  typedef typename list_type::const_iterator const_iterator;
48
  const_iterator i;
49
 
50
  // default value
51
  list_type list0202(LIST_SIZE);
52
  for (i = list0202.begin(), count = 0;
53
       i != list0202.end();
54
       ++i, ++count)
55
    VERIFY(*i == 0);
56
  VERIFY(count == LIST_SIZE);
57
  VERIFY(list0202.size() == LIST_SIZE);
58
 
59
  // explicit value
60
  list_type list0203(LIST_SIZE, INIT_VALUE);
61
  for (i = list0203.begin(), count = 0;
62
       i != list0203.end();
63
       ++i, ++count)
64
    VERIFY(*i == INIT_VALUE);
65
  VERIFY(count == LIST_SIZE);
66
  VERIFY(list0203.size() == LIST_SIZE);
67
}
68
 
69
template<typename _Tp>
70
void
71
cons022()
72
{
73
  // nontrivial value_type
74
  typedef _Tp list_type;
75
  const std::size_t LIST_SIZE = 5;
76
  list_type list0201(LIST_SIZE);
77
}

powered by: WebSVN 2.1.0

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