Commit 797d47b2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2970dd7d
...@@ -43,7 +43,7 @@ type setStr = set.Str ...@@ -43,7 +43,7 @@ type setStr = set.Str
// ΔFTestEntry represents one entry in ΔFtail tests. // ΔFTestEntry represents one entry in ΔFtail tests.
type ΔFTestEntry struct { type ΔFTestEntry struct {
δblkTab map[int64]string // changes in tree part {} #blk -> ZBlk<oid> δblkTab map[int64]string // changes in tree part {} #blk -> ZBlk<oid>
δblkData setStr // changes to ZBlk objects δdataTab setStr // changes to ZBlk objects
} }
func TestΔFtail(t_ *testing.T) { func TestΔFtail(t_ *testing.T) {
...@@ -53,7 +53,7 @@ func TestΔFtail(t_ *testing.T) { ...@@ -53,7 +53,7 @@ func TestΔFtail(t_ *testing.T) {
// δT is shorthand to create δblkTab. // δT is shorthand to create δblkTab.
type δT = map[int64]string type δT = map[int64]string
// δD is shorthand to create δblkData. // δD is shorthand to create δdataTab.
δD := func(zblkv ...string) setStr { δD := func(zblkv ...string) setStr {
δ := setStr{} δ := setStr{}
for _, zblk := range zblkv { for _, zblk := range zblkv {
...@@ -98,13 +98,13 @@ func TestΔFtail(t_ *testing.T) { ...@@ -98,13 +98,13 @@ func TestΔFtail(t_ *testing.T) {
// data built via applying changes from testv // data built via applying changes from testv
vδf := []ΔFile{} // (rev↑, {}blk) XXX +.Size? vδf := []ΔFile{} // (rev↑, {}blk) XXX +.Size?
blkTab := map[int64]string{} // #blk -> ZBlk<oid> blkTab := map[int64]string{} // #blk -> ZBlk<oid>
blkData := map[string]string{} // ZBlk<oid> -> data dataTab := map[string]string{} // ZBlk<oid> -> data
Zinblk := map[string]setI64{} // ZBlk<oid> -> which #blk refer to it Zinblk := map[string]setI64{} // ZBlk<oid> -> which #blk refer to it
// initialize blkData from root['treegen/values'] // initialize dataTab from root['treegen/values']
for /*oid*/_, zblk := range t.Head().ZBlkDataTab { for /*oid*/_, zblk := range t.Head().ZBlkDataTab {
// treegen initializes values[x] = ZBlk(x) // treegen initializes values[x] = ZBlk(x)
blkData[zblk] = zblk dataTab[zblk] = zblk
} }
...@@ -136,14 +136,14 @@ func TestΔFtail(t_ *testing.T) { ...@@ -136,14 +136,14 @@ func TestΔFtail(t_ *testing.T) {
} }
} }
// rebuild blkData // rebuild dataTab
for zblk := range test.δblkData { for zblk := range test.δdataTab {
data, ok := blkData[zblk] // e.g. a -> a2 data, ok := dataTab[zblk] // e.g. a -> a2
if !ok { if !ok {
t.Fatalf("BUG: blk %s not in blkData\nblkData: %v", zblk, blkData) t.Fatalf("BUG: blk %s not in dataTab\ndataTab: %v", zblk, dataTab)
} }
data = fmt.Sprintf("%s%d", data[:1], i) // e.g. a4 data = fmt.Sprintf("%s%d", data[:1], i) // e.g. a4
blkData[zblk] = data dataTab[zblk] = data
// update δf due to change in ZBlk data // update δf due to change in ZBlk data
for blk := range Zinblk[zblk] { for blk := range Zinblk[zblk] {
...@@ -157,8 +157,8 @@ func TestΔFtail(t_ *testing.T) { ...@@ -157,8 +157,8 @@ func TestΔFtail(t_ *testing.T) {
Size: false/*XXX*/, Size: false/*XXX*/,
}) })
// commit updated blkTab + blkData // commit updated blkTab + dataTab
tdTxt := fmt.Sprintf("t%s D%s", xbtreetest.KVTxt(blkTab), blkDataTxt(blkData)) tdTxt := fmt.Sprintf("t%s D%s", xbtreetest.KVTxt(blkTab), dataTabTxt(dataTab))
commit := t.CommitTree(tdTxt) commit := t.CommitTree(tdTxt)
fmt.Printf("@%s %s\n", commit.At, commit.Tree) fmt.Printf("@%s %s\n", commit.At, commit.Tree)
...@@ -170,9 +170,9 @@ func TestΔFtail(t_ *testing.T) { ...@@ -170,9 +170,9 @@ func TestΔFtail(t_ *testing.T) {
//} //}
// blkDataTxt returns string representation of {} blkData. // dataTabTxt returns string representation of {} dataTab.
// //
// it is similar to xbtreetest.KVTxt but uses string instead of Key for keys. // it is similar to xbtreetest.KVTxt but uses string instead of Key for keys.
func blkDataTxt(dataTab map[string]string) string { func dataTabTxt(dataTab map[string]string) string {
panic("TODO") panic("TODO")
} }
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