Skip to content

Commit b495d3d

Browse files
committed
add missing multihash tests
1 parent a4c2c4f commit b495d3d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/testBlocks.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,17 @@ function blobsStoresTestBlock!(fg)
10721072
testData = rand(UInt8, 50)
10731073
mhash = putBlob!(fs, testData)
10741074
@test mhash isa DFG.Multihash
1075+
# show(io, MIME"text/plain"(), ::Multihash)
1076+
iobuf = IOBuffer()
1077+
show(iobuf, MIME"text/plain"(), mhash)
1078+
showstr = String(take!(iobuf))
1079+
@test startswith(showstr, "multihash:")
1080+
@test length(showstr) > length("multihash:")
1081+
# decode(::Multihash)
1082+
code, digest = DFG.decode(mhash)
1083+
@test code == 0x12 # sha2_256
1084+
@test length(digest) == 32
1085+
@test DFG.Multihash(code, digest) == mhash
10751086
@test hasBlob(fs, mhash)
10761087
@test listBlobs(fs) == [mhash]
10771088
# putBlob! is idempotent

0 commit comments

Comments
 (0)