From d188a8ed36e3d43c7d6050e82bc0450a7c00c68c Mon Sep 17 00:00:00 2001 From: Alexey Navolotsky Date: Fri, 25 Sep 2020 19:34:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=82=D0=B5=D1=81=D1=82=D1=8B:=20+=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BD=D0=BE=D0=B4=D1=8B=20=D0=B2=20=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D1=83=20=D0=BF=D1=80=D0=B8=20=D0=B2=D1=8B=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=20Get=20+=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BD=D0=BE=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D1=80=D1=8B=D1=85=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=BF=D1=80=D0=B8=20=D0=B2=D1=8B=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=20Set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/storage/StorageTest.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/storage/StorageTest.cpp b/test/storage/StorageTest.cpp index b3fae8d37..3a8e3bdc1 100644 --- a/test/storage/StorageTest.cpp +++ b/test/storage/StorageTest.cpp @@ -195,3 +195,26 @@ TEST(StorageTest, MaxTest) { EXPECT_FALSE(storage.Get(key, res)); } } + +TEST(StorageTest, NodeMoveOnGet) { + SimpleLRU storage(16); + + storage.Put("KEY1", "val1"); + storage.Put("KEY2", "val2"); + + std::string value; + storage.Get("KEY1", value); + storage.Put("KEY3", "val3"); + EXPECT_TRUE(storage.Get("KEY1", value)); + EXPECT_TRUE(value == "val1"); +} + +TEST(StorageTest, ProperCleanupOnSet) { + SimpleLRU storage(12); + + storage.Put("KEY1", "val1"); + storage.Put("KEY1", "longval1"); + std::string value; + EXPECT_TRUE(storage.Get("KEY1", value)); + EXPECT_TRUE(value == "longval1"); +} \ No newline at end of file