Daily bump.
[official-gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / debug.cc
blob89d0c24a3491f942e4621e615a6613e75a7dd515
1 // { dg-do run }
2 // { dg-options "-g -O0 -std=gnu++98" }
3 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PROFILE" } }
5 // Copyright (C) 2011-2017 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 #define _GLIBCXX_DEBUG
24 #include <string>
25 #include <deque>
26 #include <bitset>
27 #include <iostream>
28 #include <list>
29 #include <map>
30 #include <set>
31 #include <vector>
32 #include <ext/slist>
34 int
35 main()
37 std::string tem;
38 std::string str = "zardoz";
39 // { dg-final { note-test str "\"zardoz\"" } }
41 std::bitset<10> bs;
42 bs[0] = 1;
43 bs[5] = 1;
44 bs[7] = 1;
45 // { dg-final { note-test bs {std::__debug::bitset = {[0] = 1, [5] = 1, [7] = 1}} } }
47 std::deque<std::string> deq;
48 deq.push_back("one");
49 deq.push_back("two");
50 // { dg-final { note-test deq {std::__debug::deque with 2 elements = {"one", "two"}} } }
52 std::deque<std::string>::iterator deqiter = deq.begin();
53 // { dg-final { note-test deqiter {"one"} } }
55 std::list<std::string> lst;
56 lst.push_back("one");
57 lst.push_back("two");
58 // { dg-final { note-test lst {std::__debug::list = {[0] = "one", [1] = "two"}} } }
60 std::list<std::string>::iterator lstiter = lst.begin();
61 tem = *lstiter;
62 // { dg-final { note-test lstiter {"one"}} }
64 std::list<std::string>::const_iterator lstciter = lst.begin();
65 tem = *lstciter;
66 // { dg-final { note-test lstciter {"one"}} }
68 std::map<std::string, int> mp;
69 mp["zardoz"] = 23;
70 // { dg-final { note-test mp {std::__debug::map with 1 element = {["zardoz"] = 23}} } }
72 std::map<std::string, int>::iterator mpiter = mp.begin();
73 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
75 // PR 67440
76 std::set<int> intset;
77 intset.insert(2);
78 intset.insert(3);
79 const std::set<int> const_intset = intset;
80 // { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } }
82 std::set<std::string> sp;
83 sp.insert("clownfish");
84 sp.insert("barrel");
85 // { dg-final { note-test sp {std::__debug::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } }
87 std::set<std::string>::const_iterator spciter = sp.begin();
88 // { dg-final { note-test spciter {"barrel"} } }
90 __gnu_cxx::slist<int> sll;
91 sll.push_front(23);
92 sll.push_front(47);
93 // { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } }
95 std::vector<int> v;
96 v.push_back(1);
97 v.push_back(2);
98 std::vector<int>::iterator viter0;
99 // { dg-final { note-test viter0 {invalid iterator} } }
100 std::vector<int>::iterator viter1 = v.begin();
101 std::vector<int>::iterator viter2 = viter1 + 1;
102 v.erase(viter1);
103 // { dg-final { note-test v {std::__debug::vector of length 1, capacity 2 = {2}} } }
104 // { dg-final { note-test viter1 {invalid iterator} } }
105 // { dg-final { note-test viter2 {invalid iterator} } }
106 std::vector<int>::iterator viter3 = v.begin();
107 // { dg-final { note-test viter3 {2} } }
109 __gnu_cxx::slist<int>::iterator slliter = sll.begin();
110 // { dg-final { note-test slliter {47} } }
112 std::cout << "\n";
113 return 0; // Mark SPOT
116 // { dg-final { gdb-test SPOT } }