mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-03-03 10:53:11 +00:00
add from nodes test
This commit is contained in:
parent
3d3f6e023e
commit
b110a63002
@ -73,6 +73,17 @@ checksuite "merkletree":
|
||||
tree.mcodec == sha256
|
||||
tree.leaves == data
|
||||
|
||||
test "Should build from nodes":
|
||||
let
|
||||
tree = CodexMerkleTree.init(sha256, leaves = data).tryGet
|
||||
fromNodes = CodexMerkleTree.fromNodes(
|
||||
nodes = toSeq(tree.nodes),
|
||||
nleaves = tree.leavesCount).tryGet
|
||||
|
||||
check:
|
||||
tree.mcodec == sha256
|
||||
tree == fromNodes
|
||||
|
||||
let
|
||||
mhash = sha256.getMhash().tryGet
|
||||
zero: seq[byte] = newSeq[byte](mhash.size)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user