From 54676448b8c822386e0b7bedc6f59e8962bc4fda Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 25 May 2024 02:26:23 +0200 Subject: [PATCH] Test SPECDB::FIFO for the right eviction of cached data. --- spec/test-fifo.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/test-fifo.cr b/spec/test-fifo.cr index 8ded150..c326374 100644 --- a/spec/test-fifo.cr +++ b/spec/test-fifo.cr @@ -22,7 +22,7 @@ describe "SPECDB::FIFO" do car2 = Car.new "Corvet-2", "red", [] of String car3 = Car.new "Corvet-3", "red", [] of String - db = SPECDB::FIFO(Car).new("", 3) + db = SPECDB::FIFO(Car).new "", 3 db.data.keys.sort.should eq([] of Int32) @@ -34,8 +34,9 @@ describe "SPECDB::FIFO" do db << car2 db.data.keys.sort.should eq([0, 1, 2] of Int32) + db[0] # Let's use the first value, it shouldn't be the one to be dropped. db << car3 - db.data.keys.sort.should eq([1, 2, 3] of Int32) + db.data.keys.sort.should eq([0, 2, 3] of Int32) end end