add test for blocktypes and inits
This commit is contained in:
parent
bbebc85541
commit
8d2bfddf0d
|
@ -64,6 +64,7 @@ else:
|
|||
switch("passC", "-mno-avx512vl")
|
||||
|
||||
when getEnv("CODEX_USE_ORC", "") in ["true", "1"]:
|
||||
echo "Using ORC"
|
||||
--mm:orc
|
||||
--deepcopy:on
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import pkg/libp2p/[cid, multicodec, multihash]
|
||||
import pkg/codex/blocktype
|
||||
from ./helpers import `==`
|
||||
import unittest2
|
||||
|
||||
suite "Blocktypes":
|
||||
setup:
|
||||
let cid0 = Cid.init("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n").get()
|
||||
test "emptyCids should work":
|
||||
let sha2 = multiCodec("sha2-256")
|
||||
let cid = emptyCid(CIDv0, sha2)
|
||||
|
||||
check cid.isOk
|
||||
check cid.get() == cid0
|
||||
|
||||
test "emptyDigest should work":
|
||||
let sha2 = multiCodec("sha2-256")
|
||||
let dig = emptyDigest(CIDv0, sha2)
|
||||
|
||||
check dig.isOk
|
||||
check dig.get() == cid0.mhash.get()
|
||||
|
||||
test "emptyBlock should work":
|
||||
let sha2 = multiCodec("sha2-256")
|
||||
let blk = emptyBlock(CIDv0, sha2)
|
||||
|
||||
check blk.isOk
|
||||
check blk.get() == Block(cid: cid0)
|
|
@ -9,6 +9,7 @@ import ./codex/teststorestream
|
|||
import ./codex/testpurchasing
|
||||
import ./codex/testsales
|
||||
import ./codex/testerasure
|
||||
import ./codex/testblocktypes
|
||||
import ./codex/testproving
|
||||
import ./codex/testutils
|
||||
import ./codex/testclock
|
||||
|
|
Loading…
Reference in New Issue