fix chunker tests
This commit is contained in:
parent
bd25fb9866
commit
7c98e78b3e
|
@ -34,17 +34,6 @@ func new*(
|
||||||
cid: Cid.init(version, codec, hash).get(),
|
cid: Cid.init(version, codec, hash).get(),
|
||||||
data: @data)
|
data: @data)
|
||||||
|
|
||||||
func new*(
|
|
||||||
T: type Block,
|
|
||||||
data: openArray[byte] = [],
|
|
||||||
version = CIDv1,
|
|
||||||
hcodec = multiCodec("sha2-256"),
|
|
||||||
codec = multiCodec("raw")): ?!T =
|
|
||||||
let hash = MultiHash.digest($hcodec, data).get()
|
|
||||||
success Block(
|
|
||||||
cid: Cid.init(version, codec, hash).get(),
|
|
||||||
data: @data)
|
|
||||||
|
|
||||||
func new*(
|
func new*(
|
||||||
T: type Block,
|
T: type Block,
|
||||||
cid: Cid,
|
cid: Cid,
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
import std/sequtils
|
|
||||||
|
|
||||||
import pkg/chronos
|
|
||||||
import pkg/asynctest
|
|
||||||
import pkg/stew/results
|
|
||||||
import pkg/dagger/chunker
|
|
||||||
import pkg/dagger/merkletree
|
|
||||||
import pkg/stew/byteutils
|
|
||||||
import pkg/dagger/p2p/rng
|
|
||||||
import pkg/dagger/blocktype as bt
|
|
||||||
|
|
||||||
suite "Data set":
|
|
||||||
|
|
||||||
test "Make from Blocks":
|
|
||||||
let
|
|
||||||
chunker = newRandomChunker(Rng.instance(), size = 256*3, chunkSize = 256)
|
|
||||||
blocks = chunker.mapIt( bt.Block.new(it) )
|
|
||||||
|
|
||||||
let merkle = MerkleTreeRef.fromBlocks(blocks)
|
|
||||||
|
|
Loading…
Reference in New Issue