aboutsummaryrefslogblamecommitdiff
path: root/test/mkllst_test.exs
blob: 68dacf3df738f32fcbe8a2f86e369e18ce32d45a (plain) (tree)
1
2
3
4
5
6
7
8
9




                             
                                  
 
                                     
 





                                                            
                            

     
defmodule ShardTest.MklLst do
  use ExUnit.Case
  doctest Shard.Application

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

    mkl = ML.new(&SData.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