]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / simple.cc
1 // If you modify this, please update simple11.cc and debug.cc as well.
2
3 // { dg-do run }
4 // { dg-options "-g -O0 -std=gnu++98" }
5
6 // Copyright (C) 2011-2016 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
22
23 // Type printers only recognize the old std::string for now.
24 #define _GLIBCXX_USE_CXX11_ABI 0
25
26 #include <string>
27 #include <deque>
28 #include <bitset>
29 #include <iostream>
30 #include <list>
31 #include <map>
32 #include <set>
33 #include <ext/slist>
34
35 int
36 main()
37 {
38 std::string tem;
39 std::string str = "zardoz";
40 // { dg-final { note-test str "\"zardoz\"" } }
41
42 std::bitset<10> bs;
43 bs[0] = 1;
44 bs[5] = 1;
45 bs[7] = 1;
46 // { dg-final { note-test bs {std::bitset = {[0] = 1, [5] = 1, [7] = 1}} } }
47
48 std::deque<std::string> deq;
49 deq.push_back("one");
50 deq.push_back("two");
51 // { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } }
52
53 std::deque<std::string>::iterator deqiter = deq.begin();
54 // { dg-final { note-test deqiter {"one"} } }
55
56 std::list<std::string> lst;
57 lst.push_back("one");
58 lst.push_back("two");
59 // { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } }
60
61 std::list<std::string>::iterator lstiter = lst.begin();
62 tem = *lstiter;
63 // { dg-final { note-test lstiter {"one"}} }
64
65 std::list<std::string>::const_iterator lstciter = lst.begin();
66 tem = *lstciter;
67 // { dg-final { note-test lstciter {"one"}} }
68
69 std::map<std::string, int> mp;
70 mp["zardoz"] = 23;
71 // { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } }
72
73 std::map<std::string, int>::iterator mpiter = mp.begin();
74 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
75
76 // PR 67440
77 std::set<int> intset;
78 intset.insert(2);
79 intset.insert(3);
80 const std::set<int> const_intset = intset;
81 // { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } }
82
83 std::set<std::string> sp;
84 sp.insert("clownfish");
85 sp.insert("barrel");
86 // { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } }
87
88 std::set<std::string>::const_iterator spciter = sp.begin();
89 // { dg-final { note-test spciter {"barrel"} } }
90
91 __gnu_cxx::slist<int> sll;
92 sll.push_front(23);
93 sll.push_front(47);
94 // { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } }
95
96 __gnu_cxx::slist<int>::iterator slliter = sll.begin();
97 // { dg-final { note-test slliter {47} } }
98
99 return 0; // Mark SPOT
100 }
101
102 // { dg-final { gdb-test SPOT } }