| 46 | } |
| 47 | |
| 48 | func (s *ObjectSuite) TestPutSameObjectWithDifferentSize(c *C) { |
| 49 | const hash = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 50 | |
| 51 | cache := NewObjectLRU(7 * Byte) |
| 52 | cache.Put(newObject(hash, 1*Byte)) |
| 53 | cache.Put(newObject(hash, 3*Byte)) |
| 54 | cache.Put(newObject(hash, 5*Byte)) |
| 55 | cache.Put(newObject(hash, 7*Byte)) |
| 56 | |
| 57 | c.Assert(cache.MaxSize, Equals, 7*Byte) |
| 58 | c.Assert(cache.actualSize, Equals, 7*Byte) |
| 59 | c.Assert(cache.ll.Len(), Equals, 1) |
| 60 | |
| 61 | obj, ok := cache.Get(plumbing.NewHash(hash)) |
| 62 | c.Assert(obj.Hash(), Equals, plumbing.NewHash(hash)) |
| 63 | c.Assert(FileSize(obj.Size()), Equals, 7*Byte) |
| 64 | c.Assert(ok, Equals, true) |
| 65 | } |
| 66 | |
| 67 | func (s *ObjectSuite) TestPutBigObject(c *C) { |
| 68 | for _, o := range s.c { |