Skip to content

Commit

Permalink
LINT: remove useless fn
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne committed Jun 13, 2023
1 parent 6e96eb7 commit ea6a53d
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions test/archethic_cache/lru_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ defmodule ArchethicCache.LRUTest do
end

test "should evict some cached values when there is not enough space available" do
binary = get_a_binary_of_bytes(200)
binary = :crypto.strong_rand_bytes(200)

{:ok, pid} = LRU.start_link(:my_cache, 500)

LRU.put(:my_cache, :key1, binary)
LRU.put(:my_cache, :key2, binary)
LRU.put(:my_cache, :key3, get_a_binary_of_bytes(400))
LRU.put(:my_cache, :key3, :crypto.strong_rand_bytes(400))

:sys.get_state(pid)

Expand All @@ -58,7 +58,7 @@ defmodule ArchethicCache.LRUTest do
end

test "should evict the LRU" do
binary = get_a_binary_of_bytes(200)
binary = :crypto.strong_rand_bytes(200)

{:ok, pid} = LRU.start_link(:my_cache, 500)

Expand Down Expand Up @@ -98,7 +98,7 @@ defmodule ArchethicCache.LRUTest do
end

test "should not cache a binary bigger than cache size" do
binary = get_a_binary_of_bytes(500)
binary = :crypto.strong_rand_bytes(500)

{:ok, pid} = LRU.start_link(:my_cache, 200)

Expand All @@ -110,7 +110,7 @@ defmodule ArchethicCache.LRUTest do
end

test "should remove all when purged" do
binary = get_a_binary_of_bytes(100)
binary = :crypto.strong_rand_bytes(100)

{:ok, _pid} = LRU.start_link(:my_cache, 500)

Expand Down Expand Up @@ -138,14 +138,4 @@ defmodule ArchethicCache.LRUTest do
assert "value1b" == LRU.get(:my_cache2, :key1)
end
end

defp get_a_binary_of_bytes(bytes) do
get_a_binary_of_bytes(bytes, <<>>)
end

defp get_a_binary_of_bytes(0, acc), do: acc

defp get_a_binary_of_bytes(bytes, acc) do
get_a_binary_of_bytes(bytes - 1, <<0::8, acc::binary>>)
end
end

0 comments on commit ea6a53d

Please sign in to comment.