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
caf65865
Commit
caf65865
authored
Jun 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
78a3503a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+10
-10
No files found.
wcfs/δbtail_test.go
View file @
caf65865
...
@@ -237,9 +237,9 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.
...
@@ -237,9 +237,9 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.
return
keyv1
[
i
]
<
keyv1
[
j
]
return
keyv1
[
i
]
<
keyv1
[
j
]
})
})
for
kidx
:=
range
IntSets
(
len
(
keyv1
))
{
for
kidx
:=
range
IntSets
(
len
(
keyv1
))
{
keys
:=
make
([]
Key
,
len
(
kidx
))
keys
:=
SetKey
{}
for
i
,
idx
:=
range
kidx
{
for
_
,
idx
:=
range
kidx
{
keys
[
i
]
=
keyv1
[
idx
]
keys
.
Add
(
keyv1
[
idx
])
}
}
xverifyΔBTail1
(
t
,
db
,
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
d12
,
δZ
,
keys
)
xverifyΔBTail1
(
t
,
db
,
treeRoot
,
at1
,
at2
,
kv1
,
kv2
,
d12
,
δZ
,
keys
)
...
@@ -248,7 +248,7 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.
...
@@ -248,7 +248,7 @@ func xverifyΔBTail(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1, at2 zodb.
// xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys.
// tracked state defined by initialTrackedKeys.
func
xverifyΔBTail1
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
kv1
,
kv2
,
d12
map
[
Key
]
string
,
δZ
*
zodb
.
EventCommit
,
initialTrackedKeys
[]
Key
)
{
func
xverifyΔBTail1
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
at1
,
at2
zodb
.
Tid
,
kv1
,
kv2
,
d12
map
[
Key
]
string
,
δZ
*
zodb
.
EventCommit
,
initialTrackedKeys
Set
Key
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
assert
:=
require
.
New
(
t
)
assert
:=
require
.
New
(
t
)
fmt
.
Println
(
"verify1"
,
initialTrackedKeys
)
fmt
.
Println
(
"verify1"
,
initialTrackedKeys
)
...
@@ -263,7 +263,7 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
...
@@ -263,7 +263,7 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
xtree
,
err
:=
zconn
.
Get
(
ctx
,
treeRoot
);
X
(
err
)
xtree
,
err
:=
zconn
.
Get
(
ctx
,
treeRoot
);
X
(
err
)
ztree
:=
xtree
.
(
*
Tree
)
ztree
:=
xtree
.
(
*
Tree
)
for
_
,
k
:=
range
initialTrackedKeys
{
for
k
:=
range
initialTrackedKeys
{
path
:=
[]
Node
{}
path
:=
[]
Node
{}
_
,
_
,
err
=
ztree
.
VGet
(
ctx
,
k
,
func
(
node
Node
)
{
_
,
_
,
err
=
ztree
.
VGet
(
ctx
,
k
,
func
(
node
Node
)
{
path
=
append
(
path
,
node
)
path
=
append
(
path
,
node
)
...
@@ -309,28 +309,28 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
...
@@ -309,28 +309,28 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
for
k
:=
range
δT
{
for
k
:=
range
δT
{
_
,
ind12
:=
d12
[
k
]
_
,
ind12
:=
d12
[
k
]
if
ind12
{
if
ind12
{
badf
(
"δT:
extra key %s
"
,
k
)
badf
(
"δT:
[%v] is extra
"
,
k
)
}
}
}
}
// k ∈ tracked set -> must be present in δT
// k ∈ tracked set -> must be present in δT
// k ∉ tracked set -> may be present in δT
// k ∉ tracked set -> may be present in δT
for
k
,
v
:=
range
d12
{
for
k
:=
range
d12
{
_
,
inδT
:=
δT
[
k
]
_
,
inδT
:=
δT
[
k
]
if
initialTrackedKeys
.
Has
(
k
)
{
if
initialTrackedKeys
.
Has
(
k
)
{
if
!
inδT
{
if
!
inδT
{
badf
(
"δT:
missing key %s
"
,
k
)
badf
(
"δT:
[%v] is missing
"
,
k
)
}
}
}
}
if
inδT
{
if
inδT
{
if
δT
[
k
]
!=
d12
[
k
]
{
if
δT
[
k
]
!=
d12
[
k
]
{
badf
(
"δT[%
s] != d12[%s
]"
,
k
,
k
)
badf
(
"δT[%
v] != d12[%v
]"
,
k
,
k
)
}
}
}
}
}
}
if
badv
!=
nil
{
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"
d12: %v
\n
δT:
%v
\n\n
"
,
d12
,
δT
)
emsg
:=
fmt
.
Sprintf
(
"
δT is wrong:
\n\n
d12: %v
\n
δT:
%v
\n\n
"
,
d12
,
δT
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
t
.
Fatal
(
emsg
)
t
.
Fatal
(
emsg
)
}
}
...
...
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