1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
8 check "gopkg.in/check.v1"
11 var _ = check.Suite(&CollectionSuite{})
13 type CollectionSuite struct{}
15 func (s *CollectionSuite) TestSizedDigests(c *check.C) {
16 coll := Collection{ManifestText: ". d41d8cd98f00b204e9800998ecf8427e+0 acbd18db4cc2f85cedef654fccc4a4d8+3 73feffa4b7f6bb68e44cf984c85f6e88+3+Z+K@xyzzy 0:0:foo 0:3:bar 3:3:baz\n"}
17 sd, err := coll.SizedDigests()
18 c.Check(err, check.IsNil)
19 c.Check(sd, check.DeepEquals, []SizedDigest{"acbd18db4cc2f85cedef654fccc4a4d8+3", "73feffa4b7f6bb68e44cf984c85f6e88+3"})
21 coll = Collection{ManifestText: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo\n. acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:bar\n. 73feffa4b7f6bb68e44cf984c85f6e88+3+Z+K@xyzzy 0:3:baz\n"}
22 sd, err = coll.SizedDigests()
23 c.Check(err, check.IsNil)
24 c.Check(sd, check.DeepEquals, []SizedDigest{"acbd18db4cc2f85cedef654fccc4a4d8+3", "73feffa4b7f6bb68e44cf984c85f6e88+3"})
26 coll = Collection{ManifestText: ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo\n"}
27 sd, err = coll.SizedDigests()
28 c.Check(err, check.IsNil)
29 c.Check(sd, check.HasLen, 0)
31 coll = Collection{ManifestText: "", PortableDataHash: "d41d8cd98f00b204e9800998ecf8427e+0"}
32 sd, err = coll.SizedDigests()
33 c.Check(err, check.IsNil)
34 c.Check(sd, check.HasLen, 0)