Merge "Fix log matching unit test bug"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ca0faeb562
@@ -358,9 +358,10 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
|
||||
|
||||
bool matchesSimple(const UidMap& uidMap, const SimpleAtomMatcher& simpleMatcher,
|
||||
const LogEvent& event) {
|
||||
if (simpleMatcher.field_value_matcher_size() <= 0) {
|
||||
return event.GetTagId() == simpleMatcher.atom_id();
|
||||
if (event.GetTagId() != simpleMatcher.atom_id()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& matcher : simpleMatcher.field_value_matcher()) {
|
||||
if (!matchesSimple(uidMap, matcher, event.getValues(), 0, event.getValues().size(), 0)) {
|
||||
return false;
|
||||
|
||||
@@ -330,6 +330,7 @@ TEST(AtomMatcherTest, TestUidFieldMatcher) {
|
||||
EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
|
||||
|
||||
// Tag found in kAtomsWithUidField and has matching uid
|
||||
simpleMatcher->set_atom_id(TAG_ID_2);
|
||||
EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event2));
|
||||
|
||||
// Tag found in kAtomsWithUidField but has non-matching uid
|
||||
|
||||
Reference in New Issue
Block a user