| 30 | } |
| 31 | |
| 32 | func (s *EncoderSuite) TestCorrectPackHeader(c *C) { |
| 33 | h, err := s.enc.Encode([]plumbing.Hash{}, 10) |
| 34 | c.Assert(err, IsNil) |
| 35 | |
| 36 | hb := [hash.Size]byte(h) |
| 37 | |
| 38 | // PACK + VERSION + OBJECTS + HASH |
| 39 | expectedResult := []byte{'P', 'A', 'C', 'K', 0, 0, 0, 2, 0, 0, 0, 0} |
| 40 | expectedResult = append(expectedResult, hb[:]...) |
| 41 | |
| 42 | result := s.buf.Bytes() |
| 43 | |
| 44 | c.Assert(result, DeepEquals, expectedResult) |
| 45 | } |
| 46 | |
| 47 | func (s *EncoderSuite) TestCorrectPackWithOneEmptyObject(c *C) { |
| 48 | o := &plumbing.MemoryObject{} |