mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-13 13:26:29 +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