From: stzuraski898 Date: Wed, 28 Jan 2026 21:49:54 +0000 (+0000) Subject: test/mgr: clang-format changes to test_ttlcache X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d2f800e4b5f697efe815adb33294a58b03a091c;p=ceph-ci.git test/mgr: clang-format changes to test_ttlcache Fixes: https://tracker.ceph.com/issues/72938 Signed-off-by: stzuraski898 --- diff --git a/src/test/mgr/test_ttlcache.cc b/src/test/mgr/test_ttlcache.cc index a1ee0a8626f..2719aa49a38 100644 --- a/src/test/mgr/test_ttlcache.cc +++ b/src/test/mgr/test_ttlcache.cc @@ -1,24 +1,26 @@ #include -#include "mgr/TTLCache.h" #include "gtest/gtest.h" +#include "mgr/TTLCache.h" using namespace std; -TEST(TTLCache, Get) { - TTLCache c{100}; - c.insert("foo", 1); - int foo = c.get("foo"); - ASSERT_EQ(foo, 1); +TEST(TTLCache, Get) +{ + TTLCache c{100}; + c.insert("foo", 1); + int foo = c.get("foo"); + ASSERT_EQ(foo, 1); } -TEST(TTLCache, Erase) { - TTLCache c{100}; - c.insert("foo", 1); - int foo = c.get("foo"); - ASSERT_EQ(foo, 1); - c.erase("foo"); - try{ +TEST(TTLCache, Erase) +{ + TTLCache c{100}; + c.insert("foo", 1); + int foo = c.get("foo"); + ASSERT_EQ(foo, 1); + c.erase("foo"); + try { foo = c.get("foo"); FAIL(); } catch (std::out_of_range& e) { @@ -26,22 +28,24 @@ TEST(TTLCache, Erase) { } } -TEST(TTLCache, Clear) { - TTLCache c{100}; - c.insert("foo", 1); - c.insert("foo2", 2); - c.clear(); - ASSERT_FALSE(c.size()); +TEST(TTLCache, Clear) +{ + TTLCache c{100}; + c.insert("foo", 1); + c.insert("foo2", 2); + c.clear(); + ASSERT_FALSE(c.size()); } -TEST(TTLCache, NoTTL) { - TTLCache c{100}; - c.insert("foo", 1); - int foo = c.get("foo"); - ASSERT_EQ(foo, 1); - c.set_ttl(0); - c.insert("foo2", 2); - try{ +TEST(TTLCache, NoTTL) +{ + TTLCache c{100}; + c.insert("foo", 1); + int foo = c.get("foo"); + ASSERT_EQ(foo, 1); + c.set_ttl(0); + c.insert("foo2", 2); + try { foo = c.get("foo2"); FAIL(); } catch (std::out_of_range& e) { @@ -49,22 +53,24 @@ TEST(TTLCache, NoTTL) { } } -TEST(TTLCache, SizeLimit) { - TTLCache c{100, 2}; - c.insert("foo", 1); - c.insert("foo2", 2); - c.insert("foo3", 3); - ASSERT_EQ(c.size(), 2); +TEST(TTLCache, SizeLimit) +{ + TTLCache c{100, 2}; + c.insert("foo", 1); + c.insert("foo2", 2); + c.insert("foo3", 3); + ASSERT_EQ(c.size(), 2); } -TEST(TTLCache, HitRatio) { - TTLCache c{100}; - c.insert("foo", 1); - c.insert("foo2", 2); - c.insert("foo3", 3); - c.get("foo2"); - c.get("foo3"); - std::pair hit_miss_ratio = c.get_hit_miss_ratio(); - ASSERT_EQ(std::get<1>(hit_miss_ratio), 3); - ASSERT_EQ(std::get<0>(hit_miss_ratio), 2); +TEST(TTLCache, HitRatio) +{ + TTLCache c{100}; + c.insert("foo", 1); + c.insert("foo2", 2); + c.insert("foo3", 3); + c.get("foo2"); + c.get("foo3"); + std::pair hit_miss_ratio = c.get_hit_miss_ratio(); + ASSERT_EQ(std::get<1>(hit_miss_ratio), 3); + ASSERT_EQ(std::get<0>(hit_miss_ratio), 2); }