mirror of
https://github.com/OlafvdSpek/ctemplate.git
synced 2025-09-28 19:05:49 +08:00
Use count instead of find
This commit is contained in:
parent
df11656259
commit
c758930da8
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user