Commit effb897e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2b697d13
......@@ -491,11 +491,11 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
// xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys.
func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, d12 map[Key]string, δZ *zodb.EventCommit, initialTrackedKeys SetKey, kadj map[Key]SetKey) {
func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, d12 map[Key]Δstring, δZ *zodb.EventCommit, initialTrackedKeys SetKey, kadj map[Key]SetKey) {
X := exc.Raiseif
var kadjTracked SetKey = nil
var δT map[Key]string = nil
var δT map[Key]Δstring = nil
// badf queues error message to be reported on return.
var badv []string
......@@ -1004,8 +1004,12 @@ func TestIntSets(t *testing.T) {
// kvdiff returns difference in between kv1 and kv2.
var DEL = "ø" // DEL means key deletion
func kvdiff(kv1, kv2 map[Key]string) map[Key]string {
delta := map[Key]string{}
type Δstring struct {
Old string
New string
}
func kvdiff(kv1, kv2 map[Key]string) map[Key]Δstring {
delta := map[Key]Δstring{}
keys := SetKey{}
for k := range kv1 { keys.Add(k) }
for k := range kv2 { keys.Add(k) }
......@@ -1016,7 +1020,7 @@ func kvdiff(kv1, kv2 map[Key]string) map[Key]string {
v2, ok := kv2[k]
if !ok { v2 = DEL }
if v1 != v2 {
delta[k] = v2
delta[k] = Δstring{v1,v2}
}
}
......@@ -1027,7 +1031,7 @@ func TestKVDiff(t *testing.T) {
kv1 := map[Key]string{1:"a", 3:"c", 4:"d"}
kv2 := map[Key]string{1:"b", 4:"d", 5:"e"}
got := kvdiff(kv1, kv2)
want := map[Key]string{1:"b", 3:DEL, 5:"e"}
want := map[Key]Δstring{1:{"a","b"}, 3:{"c",DEL}, 5:{DEL,"e"}}
if !reflect.DeepEqual(got, want) {
t.Fatalf("error:\ngot: %v\nwant: %v", got, want)
}
......@@ -1107,7 +1111,7 @@ func (os SetOid) String() string {
return "{" + strings.Join(strv, " ") + "}"
}
func sortedKeys(kv map[Key]string) []Key {
func sortedKeys(kv map[Key]Δstring) []Key {
keyv := []Key{}
for k := range kv {
keyv = append(keyv, k)
......
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