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

Commit 8cfe5567 authored by Ken Chen's avatar Ken Chen
Browse files

Fix false positive on res_stats checking in cache unit test

Utility function expectCacheStats() falsely pass while 'stats' is empty
in input parameter and not empty in cache.

Bug: 134897288
Change-Id: Ib623157301c01cffadc3c6db2c8e7c7146edeb13
parent ee085b02
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -215,6 +215,11 @@ class ResolvCacheTest : public ::testing::Test {
        EXPECT_TRUE(params == expected.setup.params) << msg;
        EXPECT_TRUE(params == expected.setup.params) << msg;


        // res_stats checking.
        // res_stats checking.
        if (expected.stats.size() == 0) {
            for (int ns = 0; ns < nscount; ns++) {
                EXPECT_EQ(0U, stats[ns].sample_count) << msg;
            }
        }
        for (size_t i = 0; i < expected.stats.size(); i++) {
        for (size_t i = 0; i < expected.stats.size(); i++) {
            EXPECT_TRUE(stats[i] == expected.stats[i]) << msg;
            EXPECT_TRUE(stats[i] == expected.stats[i]) << msg;
        }
        }