scanner: Allow disabling weak hash in scanning (fixes #3891)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3905
This commit is contained in:
Audrius Butkevicius
2017-01-23 13:50:32 +00:00
committed by Jakob Borg
parent bd55ec79d2
commit dd78177ae0
10 changed files with 45 additions and 22 deletions

View File

@@ -68,7 +68,7 @@ var blocksTestData = []struct {
func TestBlocks(t *testing.T) {
for testNo, test := range blocksTestData {
buf := bytes.NewBuffer(test.data)
blocks, err := Blocks(buf, test.blocksize, -1, nil)
blocks, err := Blocks(buf, test.blocksize, -1, nil, true)
if err != nil {
t.Fatal(err)
@@ -125,8 +125,8 @@ var diffTestData = []struct {
func TestDiff(t *testing.T) {
for i, test := range diffTestData {
a, _ := Blocks(bytes.NewBufferString(test.a), test.s, -1, nil)
b, _ := Blocks(bytes.NewBufferString(test.b), test.s, -1, nil)
a, _ := Blocks(bytes.NewBufferString(test.a), test.s, -1, nil, false)
b, _ := Blocks(bytes.NewBufferString(test.b), test.s, -1, nil, false)
_, d := BlockDiff(a, b)
if len(d) != len(test.d) {
t.Fatalf("Incorrect length for diff %d; %d != %d", i, len(d), len(test.d))