Commit e65dd03f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1dc9741a
...@@ -156,20 +156,19 @@ func TestΔFtail(t_ *testing.T) { ...@@ -156,20 +156,19 @@ func TestΔFtail(t_ *testing.T) {
} }
} }
if len(δblk) == 0 {
t.Fatal("BUG: prepared δblk = ø")
}
// commit updated blkTab + dataTab // commit updated blkTab + dataTab
tdTxt := fmt.Sprintf("t%s D%s", xbtreetest.KVTxt(blkTab), dataTabTxt(dataTab)) tdTxt := fmt.Sprintf("t%s D%s", xbtreetest.KVTxt(blkTab), dataTabTxt(dataTab))
commit := t.CommitTree(tdTxt) commit := t.CommitTree(tdTxt)
δfok := &ΔFile{ var δfok *ΔFile
Rev: commit.At, if len(δblk) != 0 {
Blocks: δblk, δfok = &ΔFile{
Size: true/*XXX*/, Rev: commit.At,
Blocks: δblk,
Size: true/*XXX*/,
}
vδf = append(vδf, δfok)
} }
vδf = append(vδf, δfok)
fmt.Printf("@%s δT: %v δD: %s\n", commit.At, test.δblkTab, test.δdataTab) fmt.Printf("@%s δT: %v δD: %s\n", commit.At, test.δblkTab, test.δdataTab)
fmt.Printf("@%s %s\n", commit.At, commit.Tree) fmt.Printf("@%s %s\n", commit.At, commit.Tree)
...@@ -177,20 +176,27 @@ func TestΔFtail(t_ *testing.T) { ...@@ -177,20 +176,27 @@ func TestΔFtail(t_ *testing.T) {
// update δftail // update δftail
δF, err := δftail.Update(commit.ΔZ); X(err) δF, err := δftail.Update(commit.ΔZ); X(err)
// assert δF points to the file // assert δF points to the file if δfok != ø
if δF.Rev != δfok.Rev { if δF.Rev != commit.At {
t.Errorf("wrong δF.Rev: have %s ; want %s", δF.Rev, δfok.Rev) t.Errorf("wrong δF.Rev: have %s ; want %s", δF.Rev, commit.At)
} }
δfiles := setOid{} δfiles := setOid{}
for δfile := range δF.ByFile { for δfile := range δF.ByFile {
δfiles.Add(δfile) δfiles.Add(δfile)
} }
δfilesOK := setOid{}; δfilesOK.Add(zfile.POid()) δfilesOK := setOid{}
if δfok != nil {
δfilesOK.Add(zfile.POid())
}
if !δfiles.Equal(δfilesOK) { if !δfiles.Equal(δfilesOK) {
t.Errorf("wrong δF.ByFile:\nhave keys: %s\nwant keys: %s", δfiles, δfilesOK) t.Errorf("wrong δF.ByFile:\nhave keys: %s\nwant keys: %s", δfiles, δfilesOK)
continue continue
} }
if δfok == nil {
continue
}
// verify δf // verify δf
δf := δF.ByFile[zfile.POid()] δf := δF.ByFile[zfile.POid()]
if !reflect.DeepEqual(δf, δfok) { if !reflect.DeepEqual(δf, δfok) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment