nim-codex/tests/codex/slots/testconverters.nim
markspanbroek fd3c566b25
update asynctest to 0.5.1 (#671)
* update asynctest to 0.5.0

Co-Authored-By: gmega <giuliano.mega@gmail.com>

* update remaining package imports

* add asynctest package wrapper

---------

Co-authored-by: gmega <giuliano.mega@gmail.com>
2024-01-29 17:03:51 -03:00

48 lines
1.0 KiB
Nim

import pkg/chronos
import pkg/poseidon2
import pkg/poseidon2/io
import pkg/constantine/math/io/io_fields
import pkg/questionable/results
import pkg/codex/merkletree
import pkg/codex/slots/converters
import ../../asynctest
import ../examples
import ../merkletree/helpers
let
hash: Poseidon2Hash = toF(12345)
suite "Converters":
test "CellBlock cid":
let
cid = toCellCid(hash).tryGet()
value = fromCellCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Slot cid":
let
cid = toSlotCid(hash).tryGet()
value = fromSlotCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Verify cid":
let
cid = toVerifyCid(hash).tryGet()
value = fromVerifyCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Proof":
let
codexProof = toEncodableProof(Poseidon2Proof.example).tryGet()
poseidonProof = toVerifiableProof(codexProof).tryGet()
check:
Poseidon2Proof.example == poseidonProof