From c481eb2b44adf50b62de3b9e3355f64973967d52 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 31 Aug 2021 12:05:29 +0200 Subject: do not fill partial cunks with padding this way a partial chunk may have less superfeatures than a complete one --- repo_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'repo_test.go') diff --git a/repo_test.go b/repo_test.go index cbb54df..cdd3024 100644 --- a/repo_test.go +++ b/repo_test.go @@ -35,16 +35,18 @@ func chunkCompare(t *testing.T, dataDir string, testFiles []string, chunkCount i i := 0 for c := range chunks { - content := buff[i*chunkSize : (i+1)*chunkSize] - if len(c) != chunkSize { - t.Errorf("Chunk %d is not of chunkSize: %d", i, chunkSize) + start := i * chunkSize + end := (i + 1) * chunkSize + if end > offset { + end = offset } + content := buff[start:end] if bytes.Compare(c, content) != 0 { t.Errorf("Chunk %d does not match file content", i) // for i, b := range c { // fmt.Printf("E: %d, A: %d\n", b, content[i]) // } - t.Log("Expected: ", c[:10], "...", c[chunkSize-10:]) + t.Log("Expected: ", c[:10], "...", c[end%chunkSize-10:]) t.Log("Actual:", content) } i++ -- cgit v1.2.3