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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [libstdc++-prettyprinters/] [cxx11.cc] - Blame information for rev 848

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

Line No. Rev Author Line
1 742 jeremybenn
// { dg-do run }
2
// { dg-options "-std=gnu++11 -g" }
3
 
4
// Copyright (C) 2011, 2012 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 <forward_list>
22
#include <unordered_map>
23
#include <unordered_set>
24
#include <string>
25
#include <iostream>
26
 
27
template<class T>
28
void
29
placeholder(const T &s)
30
{
31
  std::cout << s;
32
}
33
 
34
template<class T, class S>
35
void
36
placeholder(const std::pair<T,S> &s)
37
{
38
  std::cout << s.first;
39
}
40
 
41
template<class T>
42
void
43
use(const T &container)
44
{
45
  for (typename T::const_iterator i = container.begin();
46
       i != container.end();
47
       ++i)
48
    placeholder(*i);
49
}
50
 
51
int
52
main()
53
{
54
  std::forward_list<int> efl;
55
// { dg-final { note-test efl "empty std::forward_list" } }
56
 
57
  std::forward_list<int> fl;
58
  fl.push_front(2);
59
  fl.push_front(1);
60
// { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }
61
 
62
  std::unordered_map<int, std::string> eum;
63
// { dg-final { note-test eum "std::unordered_map with 0 elements" } }
64
  std::unordered_multimap<int, std::string> eumm;
65
// { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } }
66
  std::unordered_set<int> eus;
67
// { dg-final { note-test eus "std::unordered_set with 0 elements" } }
68
  std::unordered_multiset<int> eums;
69
// { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
70
 
71
  std::unordered_map<int, std::string> uom;
72
  uom[5] = "three";
73
  uom[3] = "seven";
74
// { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
75
 
76
  std::unordered_multimap<int, std::string> uomm;
77
  uomm.insert(std::pair<int, std::string> (5, "three"));
78
  uomm.insert(std::pair<int, std::string> (5, "seven"));
79
// { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
80
 
81
  std::unordered_set<int> uos;
82
  uos.insert(5);
83
// { dg-final { note-test uos {std::unordered_set with 1 elements = {[0] = 5}} } }
84
 
85
  std::unordered_multiset<int> uoms;
86
  uoms.insert(5);
87
// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
88
 
89
  placeholder(""); // Mark SPOT
90
  use(efl);
91
  use(fl);
92
  use(eum);
93
  use(eumm);
94
  use(eus);
95
  use(eums);
96
 
97
  return 0;
98
}
99
 
100
// { dg-final { gdb-test SPOT } }

powered by: WebSVN 2.1.0

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