Add Local Version field to files, send index in segments.

This commit is contained in:
Jakob Borg
2014-07-15 13:04:37 +02:00
parent fccdd85cc1
commit 8b349945de
16 changed files with 291 additions and 288 deletions

View File

@@ -554,7 +554,7 @@ func TestNeed(t *testing.T) {
}
}
func TestChanges(t *testing.T) {
func TestLocalVersion(t *testing.T) {
db, err := leveldb.Open(storage.NewMemStorage(), nil)
if err != nil {
t.Fatal(err)
@@ -578,17 +578,17 @@ func TestChanges(t *testing.T) {
}
m.ReplaceWithDelete(protocol.LocalNodeID, local1)
c0 := m.Changes(protocol.LocalNodeID)
c0 := m.LocalVersion(protocol.LocalNodeID)
m.ReplaceWithDelete(protocol.LocalNodeID, local2)
c1 := m.Changes(protocol.LocalNodeID)
c1 := m.LocalVersion(protocol.LocalNodeID)
if !(c1 > c0) {
t.Fatal("Change number should have incremented")
t.Fatal("Local version number should have incremented")
}
m.ReplaceWithDelete(protocol.LocalNodeID, local2)
c2 := m.Changes(protocol.LocalNodeID)
c2 := m.LocalVersion(protocol.LocalNodeID)
if c2 != c1 {
t.Fatal("Change number should be unchanged")
t.Fatal("Local version number should be unchanged")
}
}