fix chunker tests

This commit is contained in:
Dmitriy Ryajov 2021-08-27 16:11:33 -06:00
parent bd25fb9866
commit 7c98e78b3e
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
2 changed files with 0 additions and 31 deletions

View File

@ -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,

View File

@ -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)