aboutsummaryrefslogtreecommitdiff
path: root/test/mkllst_test.exs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-07-20 09:44:42 +0200
committerAlex Auvolat <alex@adnab.me>2018-07-20 09:44:42 +0200
commit8e77ababa95035e65fddbc8e331d62ceb7ab4507 (patch)
tree3732de6ccc65634d9ec55bf29f77d84ca7f1a3bf /test/mkllst_test.exs
parent058bab0d7097405126566360308ace986c18ff8e (diff)
downloadshard-8e77ababa95035e65fddbc8e331d62ceb7ab4507.tar.gz
shard-8e77ababa95035e65fddbc8e331d62ceb7ab4507.zip
Merkle list not a separate process, it makes no sense
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