diff --git a/tests/codex/testerasure.nim b/tests/codex/testerasure.nim index 41732a1a..fa034001 100644 --- a/tests/codex/testerasure.nim +++ b/tests/codex/testerasure.nim @@ -1,4 +1,5 @@ import std/sequtils +import std/sugar import pkg/asynctest import pkg/chronos @@ -10,6 +11,7 @@ import pkg/codex/manifest import pkg/codex/stores import pkg/codex/blocktype as bt import pkg/codex/rng +import pkg/codex/utils import ./helpers @@ -42,7 +44,7 @@ asyncchecksuite "Erasure encode/decode": check: encoded.blocksCount mod (buffers + parity) == 0 - encoded.rounded == (manifest.blocksCount + (buffers - (manifest.blocksCount mod buffers))) + encoded.rounded == roundUp(manifest.blocksCount, buffers) encoded.steps == encoded.rounded div buffers return encoded @@ -55,14 +57,14 @@ asyncchecksuite "Erasure encode/decode": let encoded = await encode(buffers, parity) var - column = rng.rand((encoded.blocksCount - 1) div encoded.steps) # random column + column = rng.rand((encoded.blocksCount div encoded.steps) - 1) # random column dropped: seq[int] for _ in 0..