32 #ifdef HAVE_USING_OPERATOR
44 # if defined(_LIBCPP_VERSION)
45 # ifndef GLOG_STL_LOGGING_FOR_UNORDERED
46 # define GLOG_STL_LOGGING_FOR_UNORDERED
49 # ifndef GLOG_STL_LOGGING_FOR_EXT_HASH
50 # define GLOG_STL_LOGGING_FOR_EXT_HASH
52 # ifndef GLOG_STL_LOGGING_FOR_EXT_SLIST
53 # define GLOG_STL_LOGGING_FOR_EXT_SLIST
55 # ifndef GLOG_STL_LOGGING_FOR_TR1_UNORDERED
56 # define GLOG_STL_LOGGING_FOR_TR1_UNORDERED
61 #include <glog/logging.h>
62 #include <glog/stl_logging.h>
63 #include "googletest.h"
66 #ifdef GLOG_STL_LOGGING_FOR_EXT_HASH
67 using namespace __gnu_cxx;
71 size_t operator()(
int x)
const {
return static_cast<size_t>(
x); }
74 static void TestSTLLogging() {
84 vector<int> copied_v(
v);
96 EXPECT_EQ(ss.str(),
"(10, ten) (20, twenty) (30, thirty)");
97 map< int, string > copied_m(
m);
101 #ifdef GLOG_STL_LOGGING_FOR_EXT_HASH
114 hash_set<int> copied_hs(hs);
119 #ifdef GLOG_STL_LOGGING_FOR_EXT_HASH
122 hash_map<int, string> hm;
129 EXPECT_TRUE(ss.str().find(
"(10, ten)") != string::npos);
130 EXPECT_TRUE(ss.str().find(
"(20, twenty)") != string::npos);
131 EXPECT_TRUE(ss.str().find(
"(30, thirty)") != string::npos);
132 hash_map<int, string> copied_hm(hm);
141 for (
int i = 0;
i < 100;
i++) {
143 if (
i > 0) expected +=
' ';
144 const size_t buf_size = 256;
153 CHECK_EQ(ss.str(), expected.c_str());
159 map< int, string, greater<int> >
m;
165 EXPECT_EQ(ss.str(),
"(30, thirty) (20, twenty) (10, ten)");
166 map< int, string, greater<int> > copied_m(
m);
170 #ifdef GLOG_STL_LOGGING_FOR_EXT_HASH
174 hash_set<int, user_hash> hs;
184 hash_set<int, user_hash> copied_hs(hs);
190 int main(
int,
char**) {
192 std::cout <<
"PASS\n";
201 std::cout <<
"We don't support stl_logging for this compiler.\n"
202 <<
"(we need compiler support of 'using ::operator<<' "
203 <<
"for this feature.)\n";
207 #endif // HAVE_USING_OPERATOR