From 2814b4b08910d62f8516cd3e4e77ef99ee7360e9 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 13 Mar 2018 16:02:05 -0400 Subject: [PATCH] merging, merging --- .../include/gtest/internal/gtest-port.h | 2 + googletest/test/gtest-printers_test.cc | 60 +++++++------------ 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index ccbdb76f..3e4f7b58 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -371,6 +371,8 @@ # define GTEST_HAS_STD_MOVE_ 1 # define GTEST_HAS_STD_UNIQUE_PTR_ 1 # define GTEST_HAS_STD_SHARED_PTR_ 1 +# define GTEST_HAS_UNORDERED_MAP_ 1 +# define GTEST_HAS_UNORDERED_SET_ 1 #endif // C++11 specifies that provides std::tuple. diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 1584de43..cf8bccee 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -50,14 +50,13 @@ #include "gtest/gtest.h" -// hash_set are available under Visual C++, or on Linux. -#if GTEST_HAS_HASH_MAP_ -# include // NOLINT -#endif // GTEST_HAS_HASH_MAP_ +#if GTEST_HAS_UNORDERED_MAP_ +# include // NOLINT +#endif // GTEST_HAS_UNORDERED_MAP_ -#if GTEST_HAS_HASH_SET_ -# include // NOLINT -#endif // GTEST_HAS_HASH_SET_ +#if GTEST_HAS_UNORDERED_SET_ +# include // NOLINT +#endif // GTEST_HAS_UNORDERED_SET_ #if GTEST_HAS_STD_FORWARD_LIST_ # include // NOLINT @@ -236,34 +235,6 @@ using ::testing::internal::UniversalTersePrint; using ::testing::internal::UniversalTersePrintTupleFieldsToStrings; #endif - -// 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_HASH_MAP_ - -#ifdef _STLP_HASH_MAP // We got from STLport. -using ::std::hash_map; -using ::std::hash_multimap; -#elif _MSC_VER -using ::stdext::hash_map; -using ::stdext::hash_multimap; -#endif - -#endif - -#if GTEST_HAS_HASH_SET_ - -#ifdef _STLP_HASH_MAP // We got from STLport. -using ::std::hash_map; -using ::std::hash_multimap; -#elif _MSC_VER -using ::stdext::hash_map; -using ::stdext::hash_multimap; -#endif - -#endif - // Prints a value to a string using the universal value printer. This // is a helper for testing UniversalPrinter::Print() for various types. template @@ -848,7 +819,13 @@ TEST(PrintStlContainerTest, NonEmptyDeque) { EXPECT_EQ("{ 1, 3 }", Print(non_empty)); } -#if GTEST_HAS_HASH_MAP_ +#if GTEST_HAS_UNORDERED_MAP_ + +template +using hash_map = ::std::unordered_map; +template +using hash_multimap = ::std::unordered_multimap; + TEST(PrintStlContainerTest, OneElementHashMap) { hash_map map1; @@ -868,9 +845,14 @@ TEST(PrintStlContainerTest, HashMultiMap) { << " where Print(map1) returns \"" << result << "\"."; } -#endif // GTEST_HAS_HASH_MAP_ +#endif // GTEST_HAS_UNORDERED_MAP_ -#if GTEST_HAS_HASH_SET_ +#if GTEST_HAS_UNORDERED_SET_ + +template +using hash_set = ::std::unordered_set; +template +using hash_multiset = ::std::unordered_multiset; TEST(PrintStlContainerTest, HashSet) { hash_set set1; @@ -907,7 +889,7 @@ TEST(PrintStlContainerTest, HashMultiSet) { EXPECT_TRUE(std::equal(a, a + kSize, numbers.begin())); } -#endif // GTEST_HAS_HASH_SET_ +#endif // GTEST_HAS_UNORDERED_SET_ TEST(PrintStlContainerTest, List) { const std::string a[] = {"hello", "world"};