mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-12 18:33:11 +00:00
Setting up testfixture for proof datasampler
This commit is contained in:
parent
2fc7c75fd2
commit
57f678bbf3
47
tests/codex/proof/testdatasampler.nim
Normal file
47
tests/codex/proof/testdatasampler.nim
Normal file
@ -0,0 +1,47 @@
|
||||
import std/os
|
||||
import std/strutils
|
||||
import std/sequtils
|
||||
|
||||
import pkg/questionable
|
||||
import pkg/questionable/results
|
||||
|
||||
import pkg/chronos
|
||||
import pkg/asynctest
|
||||
import pkg/stew/byteutils
|
||||
import pkg/stew/endians2
|
||||
import pkg/datastore
|
||||
|
||||
import pkg/codex/rng
|
||||
import pkg/codex/stores/cachestore
|
||||
import pkg/codex/chunker
|
||||
import pkg/codex/stores
|
||||
import pkg/codex/blocktype as bt
|
||||
import pkg/codex/clock
|
||||
import pkg/codex/utils/asynciter
|
||||
|
||||
import ../helpers
|
||||
import ../examples
|
||||
|
||||
let
|
||||
bytesPerBlock = 64 * 1024
|
||||
numberOfSlotBlocks = 10
|
||||
|
||||
asyncchecksuite "Test proof datasampler":
|
||||
let chunker = RandomChunker.new(Rng.instance(),
|
||||
size = bytesPerBlock * numberOfSlotBlocks,
|
||||
chunkSize = bytesPerBlock)
|
||||
|
||||
var slotBlocks: seq[bt.Block]
|
||||
|
||||
proc createSlotBlocks(): Future[void] {.async.} =
|
||||
while true:
|
||||
let chunk = await chunker.getBytes()
|
||||
if chunk.len <= 0:
|
||||
break
|
||||
slotBlocks.add(bt.Block.new(chunk).tryGet())
|
||||
|
||||
setup:
|
||||
await createSlotBlocks()
|
||||
|
||||
test "Should pass":
|
||||
check true
|
||||
3
tests/codex/testproof.nim
Normal file
3
tests/codex/testproof.nim
Normal file
@ -0,0 +1,3 @@
|
||||
import ./proof/testdatasampler
|
||||
|
||||
{.warning[UnusedImport]: off.}
|
||||
@ -6,6 +6,7 @@ import ./codex/testmanifest
|
||||
import ./codex/testnode
|
||||
import ./codex/teststorestream
|
||||
import ./codex/testpurchasing
|
||||
import ./codex/testproof
|
||||
import ./codex/testsales
|
||||
import ./codex/testerasure
|
||||
import ./codex/testutils
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user