diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-08-31 12:05:29 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-08-31 12:05:29 +0200 |
commit | c481eb2b44adf50b62de3b9e3355f64973967d52 (patch) | |
tree | 34a218c926f6aa6420c8abfcf703262e6148c0ed /repo_test.go | |
parent | 36da6832dce67da09d7bcee1a6ab2312e515cb0a (diff) | |
download | dna-backup-c481eb2b44adf50b62de3b9e3355f64973967d52.tar.gz dna-backup-c481eb2b44adf50b62de3b9e3355f64973967d52.zip |
do not fill partial cunks with padding
this way a partial chunk may have less superfeatures than
a complete one
Diffstat (limited to 'repo_test.go')
-rw-r--r-- | repo_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
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++ |