diff options
author | Tanzinul Islam <tanzislam@users.noreply.github.com> | 2017-11-19 20:17:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-19 20:17:46 +0000 |
commit | 4ba3803f936a2f432e60841bc9358ea2f3a951eb (patch) | |
tree | 778e7ffd3bfda62cd3be3e01a2d0207d5ffe1d82 /googletest/test/gtest-printers_test.cc | |
parent | 78b1ff074799c776f90a77203fcd7adc98e11736 (diff) | |
parent | d175c8bf823e709d570772b038757fadf63bc632 (diff) | |
download | googletest-4ba3803f936a2f432e60841bc9358ea2f3a951eb.tar.gz googletest-4ba3803f936a2f432e60841bc9358ea2f3a951eb.tar.bz2 googletest-4ba3803f936a2f432e60841bc9358ea2f3a951eb.zip |
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
Diffstat (limited to 'googletest/test/gtest-printers_test.cc')
-rw-r--r-- | googletest/test/gtest-printers_test.cc | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 487d3cb3..2a6c017e 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -51,10 +51,15 @@ #include "gtest/gtest.h" // hash_map and hash_set are available under Visual C++, or on Linux. -#if GTEST_HAS_HASH_MAP_ +#if GTEST_HAS_UNORDERED_MAP_ +# include <unordered_map> // NOLINT +#elif GTEST_HAS_HASH_MAP_ # include <hash_map> // NOLINT #endif // GTEST_HAS_HASH_MAP_ -#if GTEST_HAS_HASH_SET_ + +#if GTEST_HAS_UNORDERED_SET_ +# include <unordered_set> // NOLINT +#elif GTEST_HAS_HASH_SET_ # include <hash_set> // NOLINT #endif // GTEST_HAS_HASH_SET_ @@ -239,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings; #endif using ::testing::internal::string; -#if GTEST_HAS_HASH_MAP_ // The hash_* classes are not part of the C++ standard. STLport // defines them in namespace std. MSVC defines them in ::stdext. GCC // defines them in ::. +#if GTEST_HAS_UNORDERED_MAP_ + +#define GTEST_HAS_HASH_MAP_ 1 +template<class Key, class T> +using hash_map = ::std::unordered_map<Key, T>; +template<class Key, class T> +using hash_multimap = ::std::unordered_multimap<Key, T>; + +#elif GTEST_HAS_HASH_MAP_ + #ifdef _STLP_HASH_MAP // We got <hash_map> from STLport. using ::std::hash_map; -using ::std::hash_set; using ::std::hash_multimap; -using ::std::hash_multiset; #elif _MSC_VER using ::stdext::hash_map; -using ::stdext::hash_set; using ::stdext::hash_multimap; +#endif + +#endif + +#if GTEST_HAS_UNORDERED_SET_ + +#define GTEST_HAS_HASH_SET_ 1 +template<class Key> +using hash_set = ::std::unordered_set<Key>; +template<class Key> +using hash_multiset = ::std::unordered_multiset<Key>; + +#elif GTEST_HAS_HASH_SET_ + +#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport. +using ::std::hash_set; +using ::std::hash_multiset; +#elif _MSC_VER +using ::stdext::hash_set; using ::stdext::hash_multiset; #endif + #endif // Prints a value to a string using the universal value printer. This @@ -1061,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) { ::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT testing::internal::Int64, float, double, const char*, void*, std::string> - t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL), - "10"); + t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, + ImplicitCast_<void*>(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); @@ -1121,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) { ::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT testing::internal::Int64, float, double, const char*, void*, std::string> - t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL), - "10"); + t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, + ImplicitCast_<void*>(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); |