Commit d3f4a457 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9ee64c92
...@@ -536,7 +536,7 @@ func KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -536,7 +536,7 @@ func KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
kadj12 := _KAdj(t1,t2, keysv...) kadj12 := _KAdj(t1,t2, keysv...)
kadj21 := _KAdj(t2,t1, keysv...) kadj21 := _KAdj(t2,t1, keysv...)
if !reflect.DeepEqual(kadj12, kadj21) { if !reflect.DeepEqual(kadj12, kadj21) {
panicf("KAdj not symmetric:\nt1: %s\bt2: %s\nkadj12: %v\nkadj21: %v", panicf("KAdj not symmetric:\nt1: %s\nt2: %s\nkadj12: %v\nkadj21: %v",
t1.tree, t2.tree, kadj12, kadj21) t1.tree, t2.tree, kadj12, kadj21)
} }
return kadj12 return kadj12
...@@ -686,7 +686,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) { ...@@ -686,7 +686,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
q2.Clear() q2.Clear()
} }
adj := SetKey{}; adj.Add(k); adj.Update(adj1); adj.Update(adj2) adj := SetKey{}; adj.Add(k); adj.Update(adj1); adj.Update(adj2) // XXX kill Add(k)
kadj[k] = adj kadj[k] = adj
} }
...@@ -1456,57 +1456,57 @@ func TestΔBTail(t *testing.T) { ...@@ -1456,57 +1456,57 @@ func TestΔBTail(t *testing.T) {
// +1 // +1
Δ("T/B1:a", Δ("T/B1:a",
A{1: K(1), A{1: K(1,oo),
oo: K(1,oo)}), oo: K(1,oo)}),
// +2 // +2
Δ("T/B1:a,2:b", Δ("T/B1:a,2:b",
A{1: K(1,2), A{1: K(1,2,oo),
2: K(1,2), 2: K(1,2,oo),
oo: K(1,2,oo)}), oo: K(1,2,oo)}),
// -1 // -1
Δ("T/B2:b", Δ("T/B2:b",
A{1: K(1,2), A{1: K(1,2,oo),
2: K(1,2), 2: K(1,2,oo),
oo: K(1,2,oo)}), oo: K(1,2,oo)}),
//*/ //*/
// 2: b->c // 2: b->c
Δ("T/B2:c", Δ("T/B2:c",
A{2: K(2), A{2: K(2,oo),
oo: K(2,oo)}), oo: K(2,oo)}),
// +1 in new bucket (to the left) // +1 in new bucket (to the left)
Δ("T2/B1:a-B2:c", Δ("T2/B1:a-B2:c",
A{1: K(1,2), A{1: K(1,2,oo),
2: K(2), 2: K(1,2,oo),
oo: K(2,oo)}), // NOTE no ∞ -> 1, because 1 is added to the left oo: K(1,2,oo)}),
// +3 in new bucket (to the right) // +3 in new bucket (to the right)
Δ("T2,3/B1:a-B2:c-B3:c", Δ("T2,3/B1:a-B2:c-B3:c",
A{1: K(1), A{1: K(1),
2: K(2), 2: K(2,3,oo),
3: K(2,3), 3: K(2,3,oo),
oo: K(2,3,oo)}), oo: K(2,3,oo)}),
// bucket split; +3 in new bucket // bucket split; +3 in new bucket
"T/B1:a,2:b", "T/B1:a,2:b",
Δ("T2/B1:a-B2:b,3:c", Δ("T2/B1:a-B2:b,3:c",
A{1: K(1,2,3), A{1: K(1,2,3,oo),
2: K(1,2,3), 2: K(1,2,3,oo),
3: K(1,2,3), 3: K(1,2,3,oo),
oo: K(1,2,3,oo)}), oo: K(1,2,3,oo)}),
// bucket split; +3 in new bucket; +4 +5 in another new bucket // bucket split; +3 in new bucket; +4 +5 in another new bucket
// which remain not tracked unless previously accessed. // everything becomes tracked because original bucket had [-∞,∞) coverage
"T/B1:a,2:b", "T/B1:a,2:b",
Δ("T2,4/B1:a-B2:b,3:c-B4:d,5:e", Δ("T2,4/B1:a-B2:b,3:c-B4:d,5:e",
A{1: K(1,2,3), A{1: K(1,2,3,4,5,oo),
2: K(1,2,3), 2: K(1,2,3,4,5,oo),
3: K(1,2,3), 3: K(1,2,3,4,5,oo),
4: K(1,2,3,4,5), 4: K(1,2,3,4,5,oo),
5: K(1,2,3,4,5), 5: K(1,2,3,4,5,oo),
oo: K(1,2,3,4,5,oo)}), oo: K(1,2,3,4,5,oo)}),
// reflow of keys: even if tracked={1}, changes to all B nodes need to be rescanned: // reflow of keys: even if tracked={1}, changes to all B nodes need to be rescanned:
......
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