diff options
Diffstat (limited to 'plumbing/cache/object_test.go')
-rw-r--r-- | plumbing/cache/object_test.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/plumbing/cache/object_test.go b/plumbing/cache/object_test.go index 7d00970..e0d601a 100644 --- a/plumbing/cache/object_test.go +++ b/plumbing/cache/object_test.go @@ -32,20 +32,23 @@ func (s *ObjectSuite) SetUpTest(c *C) { func (s *ObjectSuite) TestAdd_SameObject(c *C) { s.c.Add(s.aObject) - c.Assert(s.c.actualSize, Equals, int64(1*Byte)) + c.Assert(s.c.actualSize, Equals, 1*Byte) s.c.Add(s.aObject) - c.Assert(s.c.actualSize, Equals, int64(1*Byte)) + c.Assert(s.c.actualSize, Equals, 1*Byte) } func (s *ObjectSuite) TestAdd_BigObject(c *C) { s.c.Add(s.bObject) - c.Assert(s.c.actualSize, Equals, int64(0)) + c.Assert(s.c.actualSize, Equals, 0*Byte) + c.Assert(s.c.actualSize, Equals, 0*KiByte) + c.Assert(s.c.actualSize, Equals, 0*MiByte) + c.Assert(s.c.actualSize, Equals, 0*GiByte) c.Assert(len(s.c.objects), Equals, 0) } func (s *ObjectSuite) TestAdd_CacheOverflow(c *C) { s.c.Add(s.aObject) - c.Assert(s.c.actualSize, Equals, int64(1*Byte)) + c.Assert(s.c.actualSize, Equals, 1*Byte) s.c.Add(s.cObject) c.Assert(len(s.c.objects), Equals, 2) s.c.Add(s.dObject) @@ -58,18 +61,18 @@ func (s *ObjectSuite) TestAdd_CacheOverflow(c *C) { func (s *ObjectSuite) TestClear(c *C) { s.c.Add(s.aObject) - c.Assert(s.c.actualSize, Equals, int64(1*Byte)) + c.Assert(s.c.actualSize, Equals, 1*Byte) s.c.Clear() - c.Assert(s.c.actualSize, Equals, int64(0)) + c.Assert(s.c.actualSize, Equals, 0*Byte) c.Assert(s.c.Get(s.aObject.Hash()), IsNil) } type dummyObject struct { hash plumbing.Hash - size int64 + size FileSize } -func newObject(hash string, size int64) plumbing.EncodedObject { +func newObject(hash string, size FileSize) plumbing.EncodedObject { return &dummyObject{ hash: plumbing.NewHash(hash), size: size, @@ -79,7 +82,7 @@ func newObject(hash string, size int64) plumbing.EncodedObject { func (d *dummyObject) Hash() plumbing.Hash { return d.hash } func (*dummyObject) Type() plumbing.ObjectType { return plumbing.InvalidObject } func (*dummyObject) SetType(plumbing.ObjectType) {} -func (d *dummyObject) Size() int64 { return d.size } +func (d *dummyObject) Size() int64 { return int64(d.size) } func (*dummyObject) SetSize(s int64) {} func (*dummyObject) Reader() (io.ReadCloser, error) { return nil, nil } func (*dummyObject) Writer() (io.WriteCloser, error) { return nil, nil } |