aboutsummaryrefslogtreecommitdiff
path: root/test/mkllst_test.exs
blob: ac13795f6d7ec264b61fa6944cf6bddda75c232b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
defmodule ShardTest.MklLst do
  use ExUnit.Case
  doctest Shard.Application

  test "merkle list" do
    alias SData.MerkleList, as: ML

    mkl = ML.new(&ML.cmp_ts_str/2)

    {: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