summaryrefslogtreecommitdiff
path: root/share/pretty-printers/stlport/test/test.cpp
blob: 950ef1f7d1f2dca26e086a2fccd3738fa4cc5afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#include <bitset>
#include <deque>
#include <list>
#include <memory>
#include <map>
#include <queue>
#include <set>
#ifdef _STLPORT_VERSION
#include <slist>
#endif // _STLPORT_VERSION
#include <string>
#include <stack>
#if _STLPORT_VERSION >= 0x520
#include <unordered_map>
#include <unordered_set>
#endif //_STLPORT_VERSION >= 0x520
#include <vector>

#ifdef _STLPORT_VERSION
#define STD_TR1 std::tr1
#else // _STLPORT_VERSION
#define STD_TR1 std
#endif // _STLPORT_VERSION

struct Large {
  char m_foo[100];
};

void foo() { }

int main() {

  std::string string1 = "";
  std::string string2 = "a short string";
  std::string string3 = "a very long string ...";

  std::wstring wstring1 = L"";
  std::wstring wstring2 = L"a short string";
  std::wstring wstring3 = L"a very long string ...";

  std::vector<int> vector1;
  vector1.push_back( 100);
  vector1.push_back( 200);
  vector1.push_back( 300);

  std::vector<bool> vector2;
  vector2.push_back( true);
  vector2.push_back( false);
  vector2.push_back( true);

  std::map<int,int> map1;
  map1[1] = -1;
  map1[21] = -21;
  map1[42] = -42;

  std::multimap<int,int> multimap1;
  multimap1.insert (std::pair<int,int> (1, -1));
  multimap1.insert (std::pair<int,int> (1, -2));
  multimap1.insert (std::pair<int,int> (21, -21));
  multimap1.insert (std::pair<int,int> (21, -22));
  multimap1.insert (std::pair<int,int> (42, -42));
  multimap1.insert (std::pair<int,int> (42, -43));

  std::set<int> set1;
  set1.insert( 100);
  set1.insert( 200);
  set1.insert( 300);

  std::multiset<int> multiset1;
  multiset1.insert( 100);
  multiset1.insert( 100);
  multiset1.insert( 200);
  multiset1.insert( 200);
  multiset1.insert( 300);
  multiset1.insert( 300);

  std::list<int> list1;
  std::list<int> list2;
  list1.push_back( 100);
  list1.push_back( 200);
  list1.push_back( 300);

#ifdef _STLPORT_VERSION
  std::slist<int> slist1;
  std::slist<int> slist2;
  slist1.push_front( 100);
  slist1.push_front( 200);
  slist1.push_front( 300);
#else // _STLPORT_VERSION
  std::string slist1 = "std::slist not supported";
  std::string slist2 = "std::slist not supported";
#endif // _STLPORT_VERSION

  std::deque<int> deque1;
  deque1.push_front( 100);
  deque1.push_front( 200);
  deque1.push_front( 300);

  std::deque<Large> deque2;
  deque2.push_back( Large());
  deque2.push_back( Large());
  deque2.push_front( Large());

  std::stack<int> stack1;
  stack1.push( 100);
  stack1.push( 200);
  stack1.push( 300);

  std::queue<int> queue1;
  queue1.push( 100);
  queue1.push( 200);
  queue1.push( 300);

  std::priority_queue<int> priority_queue1;
  priority_queue1.push( 200);
  priority_queue1.push( 100);
  priority_queue1.push( 300);

  std::bitset<100> bitset1;
  bitset1[2] = 1;
  bitset1[42] = 1;
  bitset1[64] = 1;
  
  std::bitset<1> bitset2;
  bitset2[0] = 1;

#if _STLPORT_VERSION >= 0x520
  STD_TR1::unordered_map<int,int> unordered_map1;
  STD_TR1::unordered_map<int,int> unordered_map2;
  for( int i = 0; i < 5; ++i)
      unordered_map1[i*i] = -i*i;

  STD_TR1::unordered_multimap<int,int> unordered_multimap1;
  STD_TR1::unordered_multimap<int,int> unordered_multimap2;
  for( int i = 0; i < 5; ++i) {
      unordered_multimap1.insert( std::pair<int,int>( i*i, -i*i));
      unordered_multimap1.insert( std::pair<int,int>( i*i,  i*i));
  }

  STD_TR1::unordered_set<int> unordered_set1;
  STD_TR1::unordered_set<int> unordered_set2;
  for( int i = 0; i < 5; ++i)
      unordered_set1.insert( i*i);
  
  STD_TR1::unordered_multiset<int> unordered_multiset1;
  STD_TR1::unordered_multiset<int> unordered_multiset2;
  for( int i = 0; i < 5; ++i) {
      unordered_multiset1.insert( -i*i);
      unordered_multiset1.insert(  i*i);
  }
#else // _STLPORT_VERSION < 0x520
  std::string unordered_map1 = "std::tr1::unordered_map not supported";
  std::string unordered_map2 = "std::tr1::unordered_map not supported";
  std::string unordered_multimap1 = "std::tr1::unordered_multimap not supported";
  std::string unordered_multimap2 = "std::tr1::unordered_multimap not supported";
  std::string unordered_set1 = "std::tr1::unordered_set not supported";
  std::string unordered_set2 = "std::tr1::unordered_set not supported";
  std::string unordered_multiset1 = "std::tr1::unordered_multiset not supported";
  std::string unordered_multiset2 = "std::tr1::unordered_multiset not supported";
#endif // _STLPORT_VERSION < 0x520

  std::auto_ptr<Large> auto_ptr1( new Large());
  std::auto_ptr<Large> auto_ptr2;

#ifdef _STLP_USE_BOOST_SUPPORT
  STD_TR1::shared_ptr<Large> shared_ptr1( new Large);
  STD_TR1::shared_ptr<Large> shared_ptr2;
  
  STD_TR1::weak_ptr<Large> weak_ptr1( shared_ptr1);
  STD_TR1::weak_ptr<Large> weak_ptr2;
#else // _STLP_USE_BOOST_SUPPORT
  std::string shared_ptr1 = "std::tr1::shared_ptr not supported";
  std::string shared_ptr2 = "std::tr1::shared_ptr not supported";

  std::string weak_ptr1 = "std::tr1::weak_ptr not supported";
  std::string weak_ptr2 = "std::tr1::weak_ptr not supported";
#endif // _STLP_USE_BOOST_SUPPORT
  
  foo();
  return 0;
}