fix chunker tests
This commit is contained in:
parent
02095967f9
commit
bd86433679
|
@ -70,7 +70,7 @@ iterator items*(c: Chunker): seq[byte] =
|
|||
|
||||
yield chunk
|
||||
|
||||
func new(
|
||||
func new*(
|
||||
T: type Chunker,
|
||||
kind = ChunkerType.SizedChunker,
|
||||
reader: Reader,
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -4,7 +4,8 @@ import pkg/dagger/chunker
|
|||
|
||||
suite "Chunking":
|
||||
test "should return proper size chunks":
|
||||
proc reader(data: var openArray[byte], offset: Natural = 0): int {.gcsafe, closure.} =
|
||||
proc reader(data: var openArray[byte], offset: Natural = 0): int
|
||||
{.gcsafe, closure, raises: [Defect].} =
|
||||
let contents = "1234567890".toBytes
|
||||
copyMem(addr data[0], unsafeAddr contents[offset], data.len)
|
||||
return data.len
|
||||
|
|
Loading…
Reference in New Issue