Skip to content

Commit

Permalink
Update fifo.test.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Sep 17, 2024
1 parent 2937be1 commit b25167e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions quickdraw/fifo.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
test "expires keys" do
fifo = Phlex::FIFO.new(max_bytesize: 3)

fifo["a"] = "a"
fifo["b"] = "b"
fifo["c"] = "c"
100.times do |i|
fifo[i] = "a"
end

expect(fifo.size) == 3
end

test "reading a key" do
fifo = Phlex::FIFO.new(max_bytesize: 3)

fifo[0] = "a"

expect(fifo[0]) == "a"
end

test "ignores values that are too large" do
fifo = Phlex::FIFO.new(max_bytesize: 100, max_value_bytesize: 10)

fifo[1] = "a" * 10
fifo[2] = "a" * 11

expect(fifo.size) == 1
end

0 comments on commit b25167e

Please sign in to comment.