Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca0faeb5 authored by Christine Tsai's avatar Christine Tsai Committed by Android (Google) Code Review
Browse files

Merge "Fix log matching unit test bug"

parents 2b3a7d06 97ae0814
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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