]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / debug.cc
1 // { dg-do run }
2 // { dg-options "-g -O0 -std=gnu++98" }
3
4 // Copyright (C) 2011-2016 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 #define _GLIBCXX_DEBUG
22
23 #include <string>
24 #include <deque>
25 #include <bitset>
26 #include <iostream>
27 #include <list>
28 #include <map>
29 #include <set>
30 #include <ext/slist>
31
32 int
33 main()
34 {
35 std::string tem;
36 std::string str = "zardoz";
37 // { dg-final { note-test str "\"zardoz\"" } }
38
39 std::bitset<10> bs;
40 bs[0] = 1;
41 bs[5] = 1;
42 bs[7] = 1;
43 // { dg-final { note-test bs {std::__debug::bitset = {[0] = 1, [5] = 1, [7] = 1}} } }
44
45 std::deque<std::string> deq;
46 deq.push_back("one");
47 deq.push_back("two");
48 // { dg-final { note-test deq {std::__debug::deque with 2 elements = {"one", "two"}} } }
49
50 std::deque<std::string>::iterator deqiter = deq.begin();
51 // { dg-final { note-test deqiter {"one"} } }
52
53 std::list<std::string> lst;
54 lst.push_back("one");
55 lst.push_back("two");
56 // { dg-final { note-test lst {std::__debug::list = {[0] = "one", [1] = "two"}} } }
57
58 std::list<std::string>::iterator lstiter = lst.begin();
59 tem = *lstiter;
60 // { dg-final { note-test lstiter {"one"}} }
61
62 std::list<std::string>::const_iterator lstciter = lst.begin();
63 tem = *lstciter;
64 // { dg-final { note-test lstciter {"one"}} }
65
66 std::map<std::string, int> mp;
67 mp["zardoz"] = 23;
68 // { dg-final { note-test mp {std::__debug::map with 1 elements = {["zardoz"] = 23}} } }
69
70 std::map<std::string, int>::iterator mpiter = mp.begin();
71 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
72
73 // PR 67440
74 std::set<int> intset;
75 intset.insert(2);
76 intset.insert(3);
77 const std::set<int> const_intset = intset;
78 // { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } }
79
80 std::set<std::string> sp;
81 sp.insert("clownfish");
82 sp.insert("barrel");
83 // { dg-final { note-test sp {std::__debug::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } }
84
85 std::set<std::string>::const_iterator spciter = sp.begin();
86 // { dg-final { note-test spciter {"barrel"} } }
87
88 __gnu_cxx::slist<int> sll;
89 sll.push_front(23);
90 sll.push_front(47);
91 // { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } }
92
93 __gnu_cxx::slist<int>::iterator slliter = sll.begin();
94 // { dg-final { note-test slliter {47} } }
95
96 return 0; // Mark SPOT
97 }
98
99 // { dg-final { gdb-test SPOT } }