1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-25 01:06:39 +00:00

Add BenchmarkDecodeIndex

This commit is contained in:
Alexander Neumann 2017-01-13 21:27:37 +01:00
parent e571b6a656
commit e463587bad

View file

@ -326,6 +326,19 @@ func TestIndexUnserialize(t *testing.T) {
} }
} }
func BenchmarkDecodeIndex(b *testing.B) {
rd := bytes.NewReader(docExample)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := rd.Seek(0, 0)
OK(b, err)
_, err = repository.DecodeIndex(rd)
OK(b, err)
}
}
func TestIndexUnserializeOld(t *testing.T) { func TestIndexUnserializeOld(t *testing.T) {
idx, err := repository.DecodeOldIndex(bytes.NewReader(docOldExample)) idx, err := repository.DecodeOldIndex(bytes.NewReader(docOldExample))
OK(t, err) OK(t, err)