@@ -11,62 +11,37 @@ import ./helpers
1111import ./ examples
1212
1313checksuite " Manifest" :
14- test " Should encode/decode to/from base manifest" :
15- var
16- manifest = Manifest .new (
17- treeCid = Cid .example,
18- blockSize = 1 .MiBs ,
19- datasetSize = 100 .MiBs )
20-
21- let
22- e = manifest.encode ().tryGet ()
23- decoded = Manifest .decode (e).tryGet ()
24-
25- check:
26- decoded == manifest
27-
28- test " Should encode/decode to/from protected manifest" :
29- var
30- manifest = Manifest .new (
31- manifest = Manifest .new (
32- treeCid = Cid .example,
33- blockSize = 1 .MiBs ,
34- datasetSize = 100 .MiBs ),
35- treeCid = Cid .example,
36- datasetSize = 200 .MiBs ,
37- eck = 10 ,
38- ecM = 10
39- )
40-
41- let
42- e = manifest.encode ().tryGet ()
43- decoded = Manifest .decode (e).tryGet ()
44-
45- check:
46- decoded == manifest
47-
48- test " Should encode/decode to/from verifiable manifest" :
49- let protectedManifest = Manifest .new (
50- manifest = Manifest .new (
51- treeCid = Cid .example,
52- blockSize = 1 .MiBs ,
53- datasetSize = 100 .MiBs ),
14+ let
15+ manifest = Manifest .new (
16+ treeCid = Cid .example,
17+ blockSize = 1 .MiBs ,
18+ datasetSize = 100 .MiBs
19+ )
20+ protectedManifest = Manifest .new (
21+ manifest = manifest,
5422 treeCid = Cid .example,
5523 datasetSize = 200 .MiBs ,
5624 eck = 10 ,
5725 ecM = 10
5826 )
59-
60- var manifest = Manifest .new (
27+ verifiableManifest = Manifest .new (
6128 manifest = protectedManifest,
6229 verificationRoot = VerificationHash .fromInt (12 ),
6330 slotRoots = @ [VerificationHash .fromInt (23 ), VerificationHash .fromInt (34 )]
6431 ).tryGet ()
6532
66- let
67- e = manifest.encode ().tryGet ()
68- decoded = Manifest .decode (e).tryGet ()
33+ proc encodeDecode (manifest: Manifest ): Manifest =
34+ let e = manifest.encode ().tryGet ()
35+ Manifest .decode (e).tryGet ()
36+
37+ test " Should encode/decode to/from base manifest" :
38+ check:
39+ encodeDecode (manifest) == manifest
6940
41+ test " Should encode/decode to/from protected manifest" :
7042 check:
71- decoded == manifest
43+ encodeDecode (protectedManifest) == protectedManifest
7244
45+ test " Should encode/decode to/from verifiable manifest" :
46+ check:
47+ encodeDecode (verifiableManifest) == verifiableManifest
0 commit comments