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

Commit 6d814037 authored by Nick Kralevich's avatar Nick Kralevich Committed by Gerrit Code Review
Browse files

Merge "libutils: fix signed/unsigned comparison warnings"

parents 28595721 3e6c4519
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -138,11 +138,11 @@ TEST_F(BitSet32Test, FillAndClear) {
TEST_F(BitSet32Test, GetIndexOfBit) {
    b1.markBit(1);
    b1.markBit(4);
    EXPECT_EQ(b1.getIndexOfBit(1), 0);
    EXPECT_EQ(b1.getIndexOfBit(4), 1);
    EXPECT_EQ(0U, b1.getIndexOfBit(1));
    EXPECT_EQ(1U, b1.getIndexOfBit(4));
    b1.markFirstUnmarkedBit();
    EXPECT_EQ(b1.getIndexOfBit(1), 1);
    EXPECT_EQ(b1.getIndexOfBit(4), 2);
    EXPECT_EQ(1U, b1.getIndexOfBit(1));
    EXPECT_EQ(2U, b1.getIndexOfBit(4));
}

class BitSet64Test : public testing::Test {
@@ -260,11 +260,11 @@ TEST_F(BitSet64Test, FillAndClear) {
TEST_F(BitSet64Test, GetIndexOfBit) {
    b1.markBit(10);
    b1.markBit(40);
    EXPECT_EQ(b1.getIndexOfBit(10), 0);
    EXPECT_EQ(b1.getIndexOfBit(40), 1);
    EXPECT_EQ(0U, b1.getIndexOfBit(10));
    EXPECT_EQ(1U, b1.getIndexOfBit(40));
    b1.markFirstUnmarkedBit();
    EXPECT_EQ(b1.getIndexOfBit(10), 1);
    EXPECT_EQ(b1.getIndexOfBit(40), 2);
    EXPECT_EQ(1U, b1.getIndexOfBit(10));
    EXPECT_EQ(2U, b1.getIndexOfBit(40));
}

} // namespace android
+7 −7
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ TEST_F(LruCacheTest, NoLeak) {

    cache.put(ComplexKey(0), ComplexValue(0));
    cache.put(ComplexKey(1), ComplexValue(1));
    EXPECT_EQ(2, cache.size());
    EXPECT_EQ(2U, cache.size());
    assertInstanceCount(2, 3);  // the null value counts as an instance
}

@@ -229,7 +229,7 @@ TEST_F(LruCacheTest, Clear) {

    cache.put(ComplexKey(0), ComplexValue(0));
    cache.put(ComplexKey(1), ComplexValue(1));
    EXPECT_EQ(2, cache.size());
    EXPECT_EQ(2U, cache.size());
    assertInstanceCount(2, 3);
    cache.clear();
    assertInstanceCount(0, 1);
@@ -241,7 +241,7 @@ TEST_F(LruCacheTest, ClearNoDoubleFree) {

        cache.put(ComplexKey(0), ComplexValue(0));
        cache.put(ComplexKey(1), ComplexValue(1));
        EXPECT_EQ(2, cache.size());
        EXPECT_EQ(2U, cache.size());
        assertInstanceCount(2, 3);
        cache.removeOldest();
        cache.clear();
@@ -255,13 +255,13 @@ TEST_F(LruCacheTest, ClearReuseOk) {

    cache.put(ComplexKey(0), ComplexValue(0));
    cache.put(ComplexKey(1), ComplexValue(1));
    EXPECT_EQ(2, cache.size());
    EXPECT_EQ(2U, cache.size());
    assertInstanceCount(2, 3);
    cache.clear();
    assertInstanceCount(0, 1);
    cache.put(ComplexKey(0), ComplexValue(0));
    cache.put(ComplexKey(1), ComplexValue(1));
    EXPECT_EQ(2, cache.size());
    EXPECT_EQ(2U, cache.size());
    assertInstanceCount(2, 3);
}

@@ -273,7 +273,7 @@ TEST_F(LruCacheTest, Callback) {
    cache.put(1, "one");
    cache.put(2, "two");
    cache.put(3, "three");
    EXPECT_EQ(3, cache.size());
    EXPECT_EQ(3U, cache.size());
    cache.removeOldest();
    EXPECT_EQ(1, callback.callbackCount);
    EXPECT_EQ(1, callback.lastKey);
@@ -288,7 +288,7 @@ TEST_F(LruCacheTest, CallbackOnClear) {
    cache.put(1, "one");
    cache.put(2, "two");
    cache.put(3, "three");
    EXPECT_EQ(3, cache.size());
    EXPECT_EQ(3U, cache.size());
    cache.clear();
    EXPECT_EQ(3, callback.callbackCount);
}
+6 −6
Original line number Diff line number Diff line
@@ -45,26 +45,26 @@ TEST_F(VectorTest, CopyOnWrite_CopyAndAddElements) {
    vector.add(2);
    vector.add(3);

    EXPECT_EQ(vector.size(), 3);
    EXPECT_EQ(3U, vector.size());

    // copy the vector
    other = vector;

    EXPECT_EQ(other.size(), 3);
    EXPECT_EQ(3U, other.size());

    // add an element to the first vector
    vector.add(4);

    // make sure the sizes are correct
    EXPECT_EQ(vector.size(), 4);
    EXPECT_EQ(other.size(), 3);
    EXPECT_EQ(4U, vector.size());
    EXPECT_EQ(3U, other.size());

    // add an element to the copy
    other.add(5);

    // make sure the sizes are correct
    EXPECT_EQ(vector.size(), 4);
    EXPECT_EQ(other.size(), 4);
    EXPECT_EQ(4U, vector.size());
    EXPECT_EQ(4U, other.size());

    // make sure the content of both vectors are correct
    EXPECT_EQ(vector[3], 4);