mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
fa0101bd60
This changes the BEP protocol to use protocol buffer serialization instead of XDR, and therefore also the database format. The local discovery protocol is also updated to be protocol buffer format. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3276 LGTM: AudriusButkevicius
24 lines
634 B
Go
24 lines
634 B
Go
// Copyright (C) 2015 The Protocol Authors.
|
|
|
|
package protocol
|
|
|
|
import "testing"
|
|
|
|
func TestWinsConflict(t *testing.T) {
|
|
testcases := [][2]FileInfo{
|
|
// The first should always win over the second
|
|
{{Modified: 42}, {Modified: 41}},
|
|
{{Modified: 41}, {Modified: 42, Deleted: true}},
|
|
{{Modified: 41, Version: Vector{[]Counter{{42, 2}, {43, 1}}}}, {Modified: 41, Version: Vector{[]Counter{{42, 1}, {43, 2}}}}},
|
|
}
|
|
|
|
for _, tc := range testcases {
|
|
if !tc[0].WinsConflict(tc[1]) {
|
|
t.Errorf("%v should win over %v", tc[0], tc[1])
|
|
}
|
|
if tc[1].WinsConflict(tc[0]) {
|
|
t.Errorf("%v should not win over %v", tc[1], tc[0])
|
|
}
|
|
}
|
|
}
|