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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [tr1/] [6_containers/] [unordered_multimap/] [erase/] [24061-multimap.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// 2005-10-08  Paolo Carlini  <pcarlini@suse.de> 
2
//
3
// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 3, or (at your option)
9
// any later version.
10
//
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License along
17
// with this library; see the file COPYING3.  If not see
18
// <http://www.gnu.org/licenses/>.
19
 
20
// 6.3.4.6  Class template unordered_multimap
21
 
22
#include <tr1/unordered_map>
23
#include <string>
24
#include <testsuite_hooks.h>
25
 
26
// libstdc++/24061
27
void test01()
28
{
29
  bool test __attribute__((unused)) = true;
30
 
31
  typedef std::tr1::unordered_multimap<std::string, int> Mmap;
32
  typedef Mmap::iterator       iterator;
33
  typedef Mmap::const_iterator const_iterator;
34
  typedef Mmap::value_type     value_type;
35
 
36
  Mmap mm1;
37
 
38
  mm1.insert(value_type("all the love in the world", 1));
39
  mm1.insert(value_type("you know what you are?", 2));
40
  mm1.insert(value_type("the collector", 3));
41
  mm1.insert(value_type("the hand that feeds", 4));
42
  mm1.insert(value_type("love is not enough", 5));
43
  mm1.insert(value_type("every day is exactly the same", 6));
44
  mm1.insert(value_type("with teeth", 7));
45
  mm1.insert(value_type("only", 8));
46
  mm1.insert(value_type("getting smaller", 9));
47
  mm1.insert(value_type("sunspots", 10));
48
 
49
  mm1.insert(value_type("you know what you are?", 5));
50
  mm1.insert(value_type("the collector", 6));
51
  mm1.insert(value_type("the hand that feeds", 7));
52
  VERIFY( mm1.size() == 13 );
53
 
54
  iterator it1 = mm1.begin();
55
  ++it1;
56
  iterator it2 = it1;
57
  ++it2;
58
  iterator it3 = mm1.erase(it1);
59
  VERIFY( mm1.size() == 12 );
60
  VERIFY( it3 == it2 );
61
  VERIFY( *it3 == *it2 );
62
 
63
  iterator it4 = mm1.begin();
64
  ++it4;
65
  ++it4;
66
  ++it4;
67
  iterator it5 = it4;
68
  ++it5;
69
  ++it5;
70
  iterator it6 = mm1.erase(it4, it5);
71
  VERIFY( mm1.size() == 10 );
72
  VERIFY( it6 == it5 );
73
  VERIFY( *it6 == *it5 );
74
 
75
  const_iterator it7 = mm1.begin();
76
  ++it7;
77
  ++it7;
78
  ++it7;
79
  const_iterator it8 = it7;
80
  ++it8;
81
  const_iterator it9 = mm1.erase(it7);
82
  VERIFY( mm1.size() == 9 );
83
  VERIFY( it9 == it8 );
84
  VERIFY( *it9 == *it8 );
85
 
86
  const_iterator it10 = mm1.begin();
87
  ++it10;
88
  const_iterator it11 = it10;
89
  ++it11;
90
  ++it11;
91
  ++it11;
92
  ++it11;
93
  const_iterator it12 = mm1.erase(it10, it11);
94
  VERIFY( mm1.size() == 5 );
95
  VERIFY( it12 == it11 );
96
  VERIFY( *it12 == *it11 );
97
 
98
  iterator it13 = mm1.erase(mm1.begin(), mm1.end());
99
  VERIFY( mm1.size() == 0 );
100
  VERIFY( it13 == mm1.end() );
101
  VERIFY( it13 == mm1.begin() );
102
}
103
 
104
int main()
105
{
106
  test01();
107
  return 0;
108
}

powered by: WebSVN 2.1.0

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