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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [23_containers/] [map/] [dr130.cc] - Blame information for rev 833

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

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
// 2008-07-22  Edward Smith-Rowland  <3dw4rd@verizon.net>
3
//
4
// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING3.  If not see
19
// <http://www.gnu.org/licenses/>.
20
 
21
#include <map>
22
#include <testsuite_hooks.h>
23
 
24
//  DR 130. Associative erase should return an iterator.
25
void
26
test01()
27
{
28
  bool test __attribute__((unused)) = true;
29
  using namespace std;
30
 
31
  map<int, int> m0;
32
  typedef map<int, int>::iterator iterator;
33
  typedef map<int, int>::const_iterator const_iterator;
34
  typedef map<int, int>::value_type value_type;
35
  typedef pair<iterator, bool> insert_return_type;
36
 
37
  m0.insert(value_type(1, 1));
38
  insert_return_type irt1 = m0.insert(value_type(2, 2));
39
  insert_return_type irt2 = m0.insert(value_type(3, 3));
40
 
41
  iterator pos1 = m0.erase(irt1.first);
42
  VERIFY( pos1 == irt2.first );
43
 
44
  iterator pos2 = m0.erase(irt2.first);
45
  VERIFY( pos2 == m0.end() );
46
}
47
 
48
void
49
test02()
50
{
51
  bool test __attribute__((unused)) = true;
52
  using namespace std;
53
 
54
  map<int, int> m0;
55
  typedef map<int, int>::iterator iterator;
56
  typedef map<int, int>::const_iterator const_iterator;
57
  typedef map<int, int>::value_type value_type;
58
  typedef pair<iterator, bool> insert_return_type;
59
 
60
  insert_return_type irt0 = m0.insert(value_type(1, 1));
61
  m0.insert(value_type(2, 2));
62
  insert_return_type irt2 = m0.insert(value_type(3, 3));
63
  insert_return_type irt3 = m0.insert(value_type(4, 4));
64
 
65
  iterator pos1 = m0.erase(irt0.first, irt2.first);
66
  VERIFY( pos1 == irt2.first );
67
 
68
  iterator pos2 = m0.erase(irt2.first, ++irt3.first);
69
  VERIFY( pos2 == m0.end() );
70
}
71
 
72
int
73
main()
74
{
75
  test01();
76
  test02();
77
}

powered by: WebSVN 2.1.0

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