From c5058f8b394aa2b13c1117e313a4c3c0e91aea15 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Thu, 12 Jul 2018 17:12:02 +0800 Subject: [PATCH] fix string_view --- src/core/core/memutil.h | 2 ++ src/core/tests/string_view_test.cpp | 44 ----------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/core/core/memutil.h b/src/core/core/memutil.h index f5d5a808f0..f53d322471 100644 --- a/src/core/core/memutil.h +++ b/src/core/core/memutil.h @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + namespace dsn { namespace strings_internal { diff --git a/src/core/tests/string_view_test.cpp b/src/core/tests/string_view_test.cpp index 2a6c426655..517986d170 100644 --- a/src/core/tests/string_view_test.cpp +++ b/src/core/tests/string_view_test.cpp @@ -18,50 +18,6 @@ namespace { -TEST(StringViewTest, STLComparator) -{ - std::string s1("foo"); - std::string s2("bar"); - std::string s3("baz"); - - dsn::string_view p1(s1); - dsn::string_view p2(s2); - dsn::string_view p3(s3); - - typedef std::map TestMap; - TestMap map; - - map.insert(std::make_pair(p1, 0)); - map.insert(std::make_pair(p2, 1)); - map.insert(std::make_pair(p3, 2)); - EXPECT_EQ(map.size(), 3); - - TestMap::const_iterator iter = map.begin(); - EXPECT_EQ(iter->second, 1); - ++iter; - EXPECT_EQ(iter->second, 2); - ++iter; - EXPECT_EQ(iter->second, 0); - ++iter; - EXPECT_TRUE(iter == map.end()); - - TestMap::iterator new_iter = map.find("zot"); - EXPECT_TRUE(new_iter == map.end()); - - new_iter = map.find("bar"); - EXPECT_TRUE(new_iter != map.end()); - - map.erase(new_iter); - EXPECT_EQ(map.size(), 2); - - iter = map.begin(); - EXPECT_EQ(iter->second, 2); - ++iter; - EXPECT_EQ(iter->second, 0); - ++iter; - EXPECT_TRUE(iter == map.end()); -} - // Separated from STL1() because some compilers produce an overly // large stack frame for the combined function. TEST(StringViewTest, STL2)