aboutsummaryrefslogtreecommitdiff
path: root/test/mkllst_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/mkllst_test.exs')
-rw-r--r--test/mkllst_test.exs14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/mkllst_test.exs b/test/mkllst_test.exs
index 4df25df..ac13795 100644
--- a/test/mkllst_test.exs
+++ b/test/mkllst_test.exs
@@ -3,14 +3,16 @@ defmodule ShardTest.MklLst do
doctest Shard.Application
test "merkle list" do
- {:ok, pid} = GenServer.start(SData.MerkleList, &SData.MerkleList.cmp_ts_str/2)
+ alias SData.MerkleList, as: ML
- {:ok, [], nil} = GenServer.call(pid, {:read, nil, nil})
+ mkl = ML.new(&ML.cmp_ts_str/2)
- 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})
+ {:ok, [], nil} = ML.read(mkl)
+
+ mkl = ML.insert(mkl, {12, "aa, bb"})
+ mkl = ML.insert_many(mkl, [{14, "qwerty"}, {8, "haha"}])
+ mkl = ML.insert(mkl, {14, "qwerty"})
+ {:ok, list, nil} = ML.read(mkl, nil, nil)
assert length(list) == 3
end
end