mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-02-27 00:43:34 +00:00
fix tests
This commit is contained in:
parent
0b47e45e91
commit
f15f3f5f27
@ -51,7 +51,7 @@ suite "Test CodexTree":
|
||||
var tree = CodexTree.init(leaves = expectedLeaves)
|
||||
check:
|
||||
tree.isOk
|
||||
tree.get().leaves == expectedLeaves.mapIt( it.bytes )
|
||||
tree.get().leaves == expectedLeaves.mapIt( it.digestBytes )
|
||||
tree.get().mcodec == sha256
|
||||
|
||||
test "Should build tree from cid leaves":
|
||||
@ -68,10 +68,10 @@ suite "Test CodexTree":
|
||||
|
||||
check:
|
||||
tree.isOk
|
||||
tree.get().leaves == expectedLeaves.mapIt( it.mhash.tryGet.bytes )
|
||||
tree.get().leaves == expectedLeaves.mapIt( it.mhash.tryGet.digestBytes )
|
||||
tree.get().mcodec == sha256
|
||||
|
||||
test "Should build from raw bytes (should not hash leaves)":
|
||||
test "Should build from raw digestbytes (should not hash leaves)":
|
||||
let
|
||||
tree = CodexTree.init(sha256, leaves = data).tryGet
|
||||
|
||||
@ -91,7 +91,7 @@ suite "Test CodexTree":
|
||||
tree == fromNodes
|
||||
|
||||
let
|
||||
mhash = sha256.getMhash().tryGet
|
||||
mhash = sha256.mhash().tryGet
|
||||
zero: seq[byte] = newSeq[byte](mhash.size)
|
||||
compress = proc(x, y: seq[byte], key: ByteTreeKey): seq[byte] =
|
||||
compress(x, y, key, mhash).tryGet
|
||||
|
||||
@ -29,11 +29,10 @@ const
|
||||
"0000000000000000000000000000006".toBytes,
|
||||
"0000000000000000000000000000007".toBytes,
|
||||
"0000000000000000000000000000008".toBytes,
|
||||
"0000000000000000000000000000009".toBytes,
|
||||
"0000000000000000000000000000010".toBytes,
|
||||
"0000000000000000000000000000009".toBytes, # note one less to account for padding of field elements
|
||||
]
|
||||
|
||||
suite "Test CodexTree":
|
||||
suite "Test Poseidon2Tree":
|
||||
var
|
||||
expectedLeaves: seq[Poseidon2Hash]
|
||||
|
||||
@ -54,8 +53,8 @@ suite "Test CodexTree":
|
||||
test "Init tree from byte leaves":
|
||||
let
|
||||
tree = Poseidon2Tree.init(
|
||||
leaves = data.mapIt(
|
||||
array[31, byte].initCopyFrom( it )
|
||||
leaves = expectedLeaves.mapIt(
|
||||
array[31, byte].initCopyFrom( it.toBytes )
|
||||
)).tryGet
|
||||
|
||||
check:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user