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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [23_containers/] [vector/] [capacity/] [1.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// 1999-05-07
2
// bkoz 
3
 
4
// Copyright (C) 1999, 2002, 2003, 2004, 2005, 2009
5
// Free Software Foundation, Inc.
6
//
7
// This file is part of the GNU ISO C++ Library.  This library is free
8
// software; you can redistribute it and/or modify it under the
9
// terms of the GNU General Public License as published by the
10
// Free Software Foundation; either version 3, or (at your option)
11
// any later version.
12
 
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License along
19
// with this library; see the file COPYING3.  If not see
20
// <http://www.gnu.org/licenses/>.
21
 
22
// 23.2.4.2 vector capacity
23
 
24
#include <vector>
25
#include <stdexcept>
26
#include <testsuite_allocator.h>
27
#include <testsuite_hooks.h>
28
 
29
template<typename T>
30
  struct A { };
31
 
32
struct B { };
33
 
34
void test01()
35
{
36
  // non POD types
37
  bool test __attribute__((unused)) = true;
38
  std::vector< A<B> > vec01;
39
  typedef std::vector< A<B> >::size_type size_type;
40
 
41
  size_type sz01 = vec01.capacity();
42
  vec01.reserve(100);
43
  size_type sz02 = vec01.capacity();
44
  VERIFY( sz02 >= sz01 );
45
 
46
  sz01 = vec01.size() + 5;
47
  vec01.resize(sz01);
48
  sz02 = vec01.size();
49
  VERIFY( sz01 == sz02 );
50
 
51
  sz01 = vec01.size() - 5;
52
  vec01.resize(sz01);
53
  sz02 = vec01.size();
54
  VERIFY( sz01 == sz02 );
55
}
56
 
57
int main()
58
{
59
  test01();
60
  return 0;
61
}

powered by: WebSVN 2.1.0

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