Commit fdb285e2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9b62c5ff
...@@ -214,7 +214,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -214,7 +214,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
xat := map[zodb.Tid]string{} // tid > "at<i>" xat := map[zodb.Tid]string{} // tid > "at<i>"
// δfstr converts δf to string taking xat into account // δfstr/vδfstr converts δf/vδf to string taking xat into account
δfstr := func(δf *ΔFile) string { δfstr := func(δf *ΔFile) string {
s := fmt.Sprintf("@%s·%s", xat[δf.Rev], δf.Blocks) s := fmt.Sprintf("@%s·%s", xat[δf.Rev], δf.Blocks)
if δf.Size { if δf.Size {
...@@ -222,6 +222,14 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -222,6 +222,14 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
} }
return s return s
} }
vδfstr := func(vδf []*ΔFile) string {
var s []string
for _, δf := range vδf {
s = append(s, δfstr(δf))
}
return fmt.Sprintf("%s", s)
}
i := 0 i := 0
for test := range testq { for test := range testq {
...@@ -303,6 +311,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -303,6 +311,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
xat[commit.At] = fmt.Sprintf("at%d", i) xat[commit.At] = fmt.Sprintf("at%d", i)
t.Logf("# → @%s (%s) δT%s δD%s\t; %s\tδ%s", xat[commit.At], commit.At, xbtreetest.KVTxt(test.δblkTab), test.δdataTab, tTxt, δblk) t.Logf("# → @%s (%s) δT%s δD%s\t; %s\tδ%s", xat[commit.At], commit.At, xbtreetest.KVTxt(test.δblkTab), test.δdataTab, tTxt, δblk)
//t.Logf("# vδf: %s", vδfstr(vδf))
//fmt.Printf("Zinblk: %v\n", Zinblk) //fmt.Printf("Zinblk: %v\n", Zinblk)
...@@ -361,6 +370,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -361,6 +370,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t.Logf("# forget ≤ @%s", xat[revcut]) t.Logf("# forget ≤ @%s", xat[revcut])
δftail.ForgetPast(revcut) δftail.ForgetPast(revcut)
vδf = vδf[1:] vδf = vδf[1:]
//t.Logf("# vδf: %s", vδfstr(vδf))
} }
// SliceByFileRev // SliceByFileRev
...@@ -377,14 +387,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -377,14 +387,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
vδf_ok := vδf[j:k+1] // [j,k] vδf_ok := vδf[j:k+1] // [j,k]
vδf_ := δftail.SliceByFileRev(zfile, lo, hi) vδf_ := δftail.SliceByFileRev(zfile, lo, hi)
if !reflect.DeepEqual(vδf_, vδf_ok) { if !reflect.DeepEqual(vδf_, vδf_ok) {
var sδf_, sδf_ok []string t.Errorf("slice (@%s,@%s]:\nhave: %v\nwant: %v", xat[lo], xat[hi], vδfstr(vδf_), vδfstr(vδf_ok))
for _, δf := range vδf_ {
sδf_ = append(sδf_, δfstr(δf))
}
for _, δf := range vδf_ok {
sδf_ok = append(sδf_ok, δfstr(δf))
}
t.Errorf("slice (@%s,@%s]:\nhave: %v\nwant: %v", xat[lo], xat[hi], sδf_, sδf_ok)
} }
} }
} }
......
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