summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-15 19:39:18 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-15 19:39:18 +0000
commit611894d11cc044ebccf44b2ad2a8a63e07ecbb84 (patch)
treed30dd906ec6223b52dc6ddcfc8daec3d80189322 /libstdc++-v3/testsuite
parentc0de02330f20127f25e6099a8689c99408d3fc1e (diff)
downloadgcc-611894d11cc044ebccf44b2ad2a8a63e07ecbb84.tar.gz
2013-05-15 François Dumont <fdumont@gcc.gnu.org>
* python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Fix rendering of std::tr1 unordered containers iterator. (StdHashtableIterator): New, render std unordered containers iterator. * testsuite/libstdc++-prettyprinters/tr1.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198947 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc90
1 files changed, 90 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc
new file mode 100644
index 00000000000..3fac36edd3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/tr1.cc
@@ -0,0 +1,90 @@
+// { dg-do run }
+// { dg-options "-g" }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+#include <string>
+#include <iostream>
+
+template<class T>
+void
+placeholder(const T &s)
+{
+ std::cout << s;
+}
+
+template<class T, class S>
+void
+placeholder(const std::pair<T,S> &s)
+{
+ std::cout << s.first;
+}
+
+template<class T>
+void
+use(const T &container)
+{
+ for (typename T::const_iterator i = container.begin();
+ i != container.end();
+ ++i)
+ placeholder(*i);
+}
+
+int
+main()
+{
+ std::tr1::unordered_map<int, std::string> eum;
+// { dg-final { note-test eum "std::tr1::unordered_map with 0 elements" } }
+ std::tr1::unordered_multimap<int, std::string> eumm;
+// { dg-final { note-test eumm "std::tr1::unordered_multimap with 0 elements" } }
+ std::tr1::unordered_set<int> eus;
+// { dg-final { note-test eus "std::tr1::unordered_set with 0 elements" } }
+ std::tr1::unordered_multiset<int> eums;
+// { dg-final { note-test eums "std::tr1::unordered_multiset with 0 elements" } }
+
+ std::tr1::unordered_map<int, std::string> uom;
+ uom[5] = "three";
+ uom[3] = "seven";
+// { dg-final { note-test uom {std::tr1::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
+
+ std::tr1::unordered_multimap<int, std::string> uomm;
+ uomm.insert(std::pair<int, std::string> (5, "three"));
+ uomm.insert(std::pair<int, std::string> (5, "seven"));
+// { dg-final { note-test uomm {std::tr1::unordered_multimap with 2 elements = {[5] = "three", [5] = "seven"}} } }
+
+ std::tr1::unordered_set<int> uos;
+ uos.insert(5);
+// { dg-final { note-test uos {std::tr1::unordered_set with 1 elements = {[0] = 5}} } }
+
+ std::tr1::unordered_multiset<int> uoms;
+ uoms.insert(5);
+// { dg-final { note-test uoms {std::tr1::unordered_multiset with 1 elements = {[0] = 5}} } }
+
+ placeholder(""); // Mark SPOT
+ use(eum);
+ use(eumm);
+ use(eus);
+ use(eums);
+ use(uoms);
+
+ return 0;
+}
+
+// { dg-final { gdb-test SPOT } }