Use count function instead of handwritten loop

This commit is contained in:
ppenguin 2020-05-25 14:25:16 +08:00 committed by GitHub
parent 011959aafd
commit 80d5177ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,17 +78,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
continue;
}
bool found = false;
for (RegisteredTestIter it = registered_tests_.begin();
it != registered_tests_.end();
++it) {
if (name == it->first) {
found = true;
break;
}
}
if (found) {
if (registered_tests_.count(name) != 0) {
tests.insert(name);
} else {
errors << "No test named " << name