From c758930da8bf664e6e53591237d513bfc57cd121 Mon Sep 17 00:00:00 2001 From: "olafvdspek@gmail.com" Date: Wed, 19 Dec 2012 08:07:45 +0000 Subject: [PATCH] Use count instead of find --- src/tests/htmlparser_cpp_test.cc | 4 ++-- src/tests/template_unittest.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/htmlparser_cpp_test.cc b/src/tests/htmlparser_cpp_test.cc index 47c65c1..c0f71b5 100644 --- a/src/tests/htmlparser_cpp_test.cc +++ b/src/tests/htmlparser_cpp_test.cc @@ -500,12 +500,12 @@ void HtmlparserCppTest::ProcessAnnotation(const string &annotation) { } else if (iter->first.compare("is_url_start") == 0) { ValidateIsUrlStart(iter->second); } else if (iter->first.compare("save_context") == 0) { - if (contextMap.find(iter->second) == contextMap.end()) { + if (!contextMap.count(iter->second)) { contextMap[iter->second] = new HtmlParser(); } contextMap[iter->second]->CopyFrom(&parser_); } else if (iter->first.compare("load_context") == 0) { - CHECK(contextMap.find(iter->second) != contextMap.end()); + CHECK(contextMap.count(iter->second)); parser_.CopyFrom(contextMap[iter->second]); } else if (iter->first.compare("reset") == 0) { if (StringToBool(iter->second)) { diff --git a/src/tests/template_unittest.cc b/src/tests/template_unittest.cc index 60edbb7..8d615c0 100644 --- a/src/tests/template_unittest.cc +++ b/src/tests/template_unittest.cc @@ -1455,10 +1455,10 @@ TEST(Template, TemplateNamelist) { TemplateNamelist::NameListType names = TemplateNamelist::GetList(); ASSERT(names.size() == 4); - ASSERT(names.find(NONEXISTENT_FN) != names.end()); - ASSERT(names.find(INVALID1_FN) != names.end()); - ASSERT(names.find(INVALID2_FN) != names.end()); - ASSERT(names.find(VALID1_FN) != names.end()); + ASSERT(names.count(NONEXISTENT_FN)); + ASSERT(names.count(INVALID1_FN)); + ASSERT(names.count(INVALID2_FN)); + ASSERT(names.count(VALID1_FN)); // Before creating the files INVALID1_FN, etc., all should be missing. for (int i = 0; i < 3; ++i) { // should be consistent all 3 times