Commit 964898fa authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e65dd03f
......@@ -43,36 +43,18 @@ import (
type setStr = set.Str
const ø = "ø"
// ΔFTestEntry represents one entry in ΔFtail tests.
type ΔFTestEntry struct {
δblkTab map[int64]string // changes in tree part {} #blk -> ZBlk<oid>
δdataTab setStr // changes to ZBlk objects
}
func TestΔFtail(t_ *testing.T) {
func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t := xbtreetest.NewT(t_)
X := exc.Raiseif
// δT is shorthand to create δblkTab.
type δT = map[int64]string
// δD is shorthand to create δdataTab.
δD := func(zblkv ...string) setStr {
δ := setStr{}
for _, zblk := range zblkv {
δ.Add(zblk)
}
return δ
}
const a, b, c, ø = "a", "b", "c", "ø"
testv := []ΔFTestEntry{
{δT{1:a,2:b,3:ø}, δD(a)},
{δT{}, δD(c)},
{δT{2:c}, δD(a,b)},
}
δftail := NewΔFtail(t.Head().At, t.DB)
// load zfile via root['treegen/file']
......@@ -111,7 +93,9 @@ func TestΔFtail(t_ *testing.T) {
}
for i, test := range testv {
i := 0
for test := range testq {
i++
fmt.Printf("\nδT: %v δD: %s\n", test.δblkTab, test.δdataTab)
δblk := setI64{}
......@@ -207,8 +191,41 @@ func TestΔFtail(t_ *testing.T) {
}
}
// XXX TestΔFtailRandom(t *testing.T) {
//}
func TestΔFtail(t *testing.T) {
// δT is shorthand to create δblkTab.
type δT = map[int64]string
// δD is shorthand to create δdataTab.
δD := func(zblkv ...string) setStr {
δ := setStr{}
for _, zblk := range zblkv {
δ.Add(zblk)
}
return δ
}
const a, b, c = "a", "b", "c"
testv := []ΔFTestEntry{
{δT{1:a,2:b,3:ø}, δD(a)},
{δT{}, δD(c)},
{δT{2:c}, δD(a,b)},
// XXX more
}
testq := make(chan ΔFTestEntry)
go func() {
defer close(testq)
for _, test := range testv {
testq <- test
}
}()
testΔFtail(t, testq)
}
func TestΔFtailRandom(t *testing.T) {
// XXX
}
// dataTabTxt returns string representation of {} dataTab.
......
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