sync code

This commit is contained in:
Ned Wright
2024-09-15 02:49:26 +00:00
parent f4bad4c4d9
commit eddd250409
48 changed files with 368 additions and 174 deletions

View File

@@ -151,10 +151,10 @@ TEST(TempCaching, capacity)
cache.createEntry(3);
cache.createEntry(4);
EXPECT_EQ(cache.size(), 5);
EXPECT_EQ(cache.capacity(), 0);
EXPECT_EQ(cache.size(), 5u);
EXPECT_EQ(cache.capacity(), 0u);
cache.capacity(3);
EXPECT_EQ(cache.size(), 3);
EXPECT_EQ(cache.size(), 3u);
EXPECT_FALSE(cache.doesKeyExists(0));
EXPECT_FALSE(cache.doesKeyExists(1));
EXPECT_TRUE(cache.doesKeyExists(2));
@@ -162,7 +162,7 @@ TEST(TempCaching, capacity)
EXPECT_TRUE(cache.doesKeyExists(4));
cache.createEntry(5);
EXPECT_EQ(cache.size(), 3);
EXPECT_EQ(cache.size(), 3u);
EXPECT_FALSE(cache.doesKeyExists(2));
EXPECT_TRUE(cache.doesKeyExists(3));
EXPECT_TRUE(cache.doesKeyExists(4));
@@ -170,7 +170,7 @@ TEST(TempCaching, capacity)
cache.capacity(0);
cache.createEntry(6);
EXPECT_EQ(cache.size(), 4);
EXPECT_EQ(cache.size(), 4u);
EXPECT_TRUE(cache.doesKeyExists(3));
EXPECT_TRUE(cache.doesKeyExists(4));
EXPECT_TRUE(cache.doesKeyExists(5));
@@ -178,7 +178,7 @@ TEST(TempCaching, capacity)
cache.deleteEntry(5);
cache.capacity(2);
EXPECT_EQ(cache.size(), 2);
EXPECT_EQ(cache.size(), 2u);
EXPECT_TRUE(cache.doesKeyExists(4));
EXPECT_TRUE(cache.doesKeyExists(6));
}

View File

@@ -161,6 +161,7 @@ public:
public:
MyValue(int _x) : x(_x) { addObj(this); }
MyValue(const MyValue &other) : x(other.x) { addObj(this); }
MyValue & operator=(const MyValue &other) = default;
~MyValue() { delObj(this); }
bool operator==(const MyValue &other) const { return x==other.x; }
bool operator!=(const MyValue &other) const { return x!=other.x; }
@@ -208,9 +209,9 @@ TEST_F(MaybeAssignments, ValValRval)
Maybe<MyValue, MyValue> m(MyValue(1));
// Change the value
EXPECT_EQ(1, m->x);
EXPECT_EQ(m->x, 1);
m = 2;
EXPECT_EQ(2, m->x);
EXPECT_EQ(m->x, 2);
}
TEST_F(MaybeAssignments, ValValLval)