Commit f8102804 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d962ce87
......@@ -601,7 +601,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// - outside tracked set -> may be present in δT (kadj gives exact answer)
// δT is subset of d12
for k := range δT {
for _, k := range SortedKeys(δT) {
_, ind12 := d12[k]
if ind12 {
badf("δT: [%v] is not in d12", k)
......@@ -610,7 +610,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// k ∈ tracked set -> must be present in δT
// k ∉ tracked set -> may be present in δT (kadj gives exact answer)
for k := range d12 {
for _, k := range SortedKeys(d12) {
_, inδT := δT[k]
if inδT && !inδTOK.Has(k) {
badf("δT: [%v] is extra", k)
......@@ -1073,15 +1073,29 @@ func xkvFlatten(xkv RBucketSet) map[Key]string {
}
// easies debugging.
func (ks SetKey) String() string {
// easies debugging / makes error output stable from run to run.
func (ks SetKey) SortedKeys() []Key {
keyv := ks.Elements()
sort.Slice(keyv, func(i, j int) bool {
return keyv[i] < keyv[j]
})
return keyv
}
func (ks SetKey) String() string {
strv := []string{}
for _, k := range keyv {
for _, k := range ks.SortedKeys() {
strv = append(strv, fmt.Sprintf("%d", k))
}
return "{" + strings.Join(strv, " ") + "}"
}
func SortedKeys(kv map[Key]string) []Key {
keyv := []Key{}
for k := range kv {
keyv = append(keyv, k)
}
sort.Slice(keyv, func(i, j int) bool {
return keyv[i] < keyv[j]
})
return keyv
}
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