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
1a1c5941
Commit
1a1c5941
authored
Jun 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e2dbfff6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+19
-8
No files found.
wcfs/δbtail_test.go
View file @
1a1c5941
...
@@ -429,13 +429,13 @@ func TestIntSets(t *testing.T) {
...
@@ -429,13 +429,13 @@ func TestIntSets(t *testing.T) {
// kvdiff returns differens in between kv1 and kv2.
// kvdiff returns differens in between kv1 and kv2.
var
DEL
=
"ø"
var
DEL
=
"ø"
// DEL means key deletion
type
kvdelta1
struct
{
//
type kvdelta1 struct {
k
Key
//
k Key
v
string
// DEL means delete
//
v string // DEL means delete
}
//
}
func
kvdiff
(
kv1
,
kv2
map
[
Key
]
string
)
[]
kvdelta1
{
func
kvdiff
(
kv1
,
kv2
map
[
Key
]
string
)
map
[
Key
]
string
{
delta
:=
[]
kvdelta1
{}
delta
:=
map
[
Key
]
string
{}
keys
:=
SetKey
{}
keys
:=
SetKey
{}
for
k
:=
range
kv1
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv1
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv2
{
keys
.
Add
(
k
)
}
for
k
:=
range
kv2
{
keys
.
Add
(
k
)
}
...
@@ -451,9 +451,20 @@ func kvdiff(kv1, kv2 map[Key]string) []kvdelta1 {
...
@@ -451,9 +451,20 @@ func kvdiff(kv1, kv2 map[Key]string) []kvdelta1 {
v2
,
ok
:=
kv2
[
k
]
v2
,
ok
:=
kv2
[
k
]
if
!
ok
{
v2
=
DEL
}
if
!
ok
{
v2
=
DEL
}
if
v1
!=
v2
{
if
v1
!=
v2
{
delta
=
append
(
delta
,
kvdelta1
{
k
,
v2
})
delta
[
k
]
=
v2
}
}
}
}
return
delta
return
delta
}
}
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"
}
if
!
reflect
.
DeepEqual
(
got
,
want
)
{
t
.
Fatalf
(
"error:
\n
got: %v
\n
want: %v"
,
got
,
want
)
}
}
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