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
205c6247
Commit
205c6247
authored
Jun 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
129fe522
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
7 deletions
+40
-7
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+40
-7
No files found.
wcfs/δbtail_test.go
View file @
205c6247
...
@@ -289,18 +289,47 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
...
@@ -289,18 +289,47 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
}
}
assert
.
Equal
(
roots
,
[]
zodb
.
Oid
{
treeRoot
})
assert
.
Equal
(
roots
,
[]
zodb
.
Oid
{
treeRoot
})
δT
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δT
oid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> oid
δT
str
:=
XGetKV
(
db
,
at2
,
δT
)
// {} k -> ZBlk(oid).data
δT
:=
XGetKV
(
db
,
at2
,
δToid
)
// {} k -> ZBlk(oid).data
fmt
.
Println
(
"d12:"
,
d12
)
fmt
.
Println
(
"d12:"
,
d12
)
fmt
.
Println
(
"δT: "
,
δTstr
)
fmt
.
Println
(
"δT: "
,
δT
)
var
badv
[]
string
badf
:=
func
(
format
string
,
argv
...
interface
{})
{
badv
=
append
(
badv
,
fmt
.
Sprintf
(
format
,
argv
...
))
}
// δT must be subset of d12.
// δT must be subset of d12.
// changed keys, that are
// changed keys, that are
// - in tracked set -> must be present in δT
// - in tracked set -> must be present in δT
// - outside tracked set -> may be present in δT
// - outside tracked set -> may be present in δT
//
// all keys from d12/tracked are present in δT
// subset
for
k
:=
range
δT
{
_
,
ind12
:=
d12
[
k
]
if
ind12
{
badf
(
"δT: extra key %s"
,
k
)
}
}
// all keys from d12/tracked are in δT
for
k
,
v
:=
range
d12
{
_
,
inδT
:=
δT
[
k
]
// k ∈ tracked set -> must be present in δT
// k ∉ tracked set -> may be present in δT
if
initialTrackedKeys
.
Has
(
k
)
{
if
!
inδT
{
badf
(
"δT: missing key %s"
,
k
)
}
}
if
inδT
{
if
δT
[
k
]
!=
d12
[
k
]
{
badf
(
"δT[%s] != d12[%s]"
,
k
,
k
)
}
}
}
//for (k,v) in d12:
//for (k,v) in d12:
// if k in initialTrackedKeys:
// if k in initialTrackedKeys:
// assert k in δT
// assert k in δT
...
@@ -308,8 +337,12 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
...
@@ -308,8 +337,12 @@ func xverifyΔBTail1(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.
// else:
// else:
// if k in δT:
// if k in δT:
// assert δT[k] == v
// assert δT[k] == v
//
// XXX all keys from δT are present in d12
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"d12: %v
\n
δT: %v
\n\n
"
,
d12
,
δT
)
emsg
+=
strings
.
Join
(
badv
,
"
\n
"
)
t
.
Fatal
(
emsg
)
}
}
}
func
TestΔBTail
(
t
*
testing
.
T
)
{
func
TestΔBTail
(
t
*
testing
.
T
)
{
...
...
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