Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
effb897e
Commit
effb897e
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2b697d13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+11
-7
No files found.
wcfs/δbtail_test.go
View file @
effb897e
...
...
@@ -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:
\n
got: %v
\n
want: %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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment