1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
defmodule ShardTest.MklLst do
use ExUnit.Case
doctest Shard.Application
test "merkle list" do
{:ok, pid} = GenServer.start(SData.MerkleList, &SData.MerkleList.cmp_ts_str/2)
{:ok, [], nil} = GenServer.call(pid, {:read, nil, nil})
GenServer.cast(pid, {:insert, {12, "aa, bb"}})
GenServer.cast(pid, {:insert_many, [{14, "qwerty"}, {8, "haha"}]})
GenServer.cast(pid, {:insert, {14, "qwerty"}})
{:ok, list, nil} = GenServer.call(pid, {:read, nil, nil})
assert length(list) == 3
end
end
|