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
797d47b2
Commit
797d47b2
authored
Jul 08, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2970dd7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+14
-14
No files found.
wcfs/internal/zdata/δftail_test.go
View file @
797d47b2
...
@@ -43,7 +43,7 @@ type setStr = set.Str
...
@@ -43,7 +43,7 @@ type setStr = set.Str
// ΔFTestEntry represents one entry in ΔFtail tests.
// ΔFTestEntry represents one entry in ΔFtail tests.
type
ΔFTestEntry
struct
{
type
ΔFTestEntry
struct
{
δblkTab
map
[
int64
]
string
// changes in tree part {} #blk -> ZBlk<oid>
δblkTab
map
[
int64
]
string
// changes in tree part {} #blk -> ZBlk<oid>
δ
blkData
setStr
// changes to ZBlk objects
δ
dataTab
setStr
// changes to ZBlk objects
}
}
func
TestΔFtail
(
t_
*
testing
.
T
)
{
func
TestΔFtail
(
t_
*
testing
.
T
)
{
...
@@ -53,7 +53,7 @@ func TestΔFtail(t_ *testing.T) {
...
@@ -53,7 +53,7 @@ func TestΔFtail(t_ *testing.T) {
// δT is shorthand to create δblkTab.
// δT is shorthand to create δblkTab.
type
δT
=
map
[
int64
]
string
type
δT
=
map
[
int64
]
string
// δD is shorthand to create δ
blkData
.
// δD is shorthand to create δ
dataTab
.
δD
:=
func
(
zblkv
...
string
)
setStr
{
δD
:=
func
(
zblkv
...
string
)
setStr
{
δ
:=
setStr
{}
δ
:=
setStr
{}
for
_
,
zblk
:=
range
zblkv
{
for
_
,
zblk
:=
range
zblkv
{
...
@@ -98,13 +98,13 @@ func TestΔFtail(t_ *testing.T) {
...
@@ -98,13 +98,13 @@ func TestΔFtail(t_ *testing.T) {
// data built via applying changes from testv
// data built via applying changes from testv
vδf
:=
[]
ΔFile
{}
// (rev↑, {}blk) XXX +.Size?
vδf
:=
[]
ΔFile
{}
// (rev↑, {}blk) XXX +.Size?
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<oid>
blkTab
:=
map
[
int64
]
string
{}
// #blk -> ZBlk<oid>
blkData
:=
map
[
string
]
string
{}
// ZBlk<oid> -> data
dataTab
:=
map
[
string
]
string
{}
// ZBlk<oid> -> data
Zinblk
:=
map
[
string
]
setI64
{}
// ZBlk<oid> -> which #blk refer to it
Zinblk
:=
map
[
string
]
setI64
{}
// ZBlk<oid> -> which #blk refer to it
// initialize
blkData
from root['treegen/values']
// initialize
dataTab
from root['treegen/values']
for
/*oid*/
_
,
zblk
:=
range
t
.
Head
()
.
ZBlkDataTab
{
for
/*oid*/
_
,
zblk
:=
range
t
.
Head
()
.
ZBlkDataTab
{
// treegen initializes values[x] = ZBlk(x)
// treegen initializes values[x] = ZBlk(x)
blkData
[
zblk
]
=
zblk
dataTab
[
zblk
]
=
zblk
}
}
...
@@ -136,14 +136,14 @@ func TestΔFtail(t_ *testing.T) {
...
@@ -136,14 +136,14 @@ func TestΔFtail(t_ *testing.T) {
}
}
}
}
// rebuild
blkData
// rebuild
dataTab
for
zblk
:=
range
test
.
δ
blkData
{
for
zblk
:=
range
test
.
δ
dataTab
{
data
,
ok
:=
blkData
[
zblk
]
// e.g. a -> a2
data
,
ok
:=
dataTab
[
zblk
]
// e.g. a -> a2
if
!
ok
{
if
!
ok
{
t
.
Fatalf
(
"BUG: blk %s not in
blkData
\n
blkData: %v"
,
zblk
,
blkData
)
t
.
Fatalf
(
"BUG: blk %s not in
dataTab
\n
dataTab: %v"
,
zblk
,
dataTab
)
}
}
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
data
=
fmt
.
Sprintf
(
"%s%d"
,
data
[
:
1
],
i
)
// e.g. a4
blkData
[
zblk
]
=
data
dataTab
[
zblk
]
=
data
// update δf due to change in ZBlk data
// update δf due to change in ZBlk data
for
blk
:=
range
Zinblk
[
zblk
]
{
for
blk
:=
range
Zinblk
[
zblk
]
{
...
@@ -157,8 +157,8 @@ func TestΔFtail(t_ *testing.T) {
...
@@ -157,8 +157,8 @@ func TestΔFtail(t_ *testing.T) {
Size
:
false
/*XXX*/
,
Size
:
false
/*XXX*/
,
})
})
// commit updated blkTab +
blkData
// commit updated blkTab +
dataTab
tdTxt
:=
fmt
.
Sprintf
(
"t%s D%s"
,
xbtreetest
.
KVTxt
(
blkTab
),
blkDataTxt
(
blkData
))
tdTxt
:=
fmt
.
Sprintf
(
"t%s D%s"
,
xbtreetest
.
KVTxt
(
blkTab
),
dataTabTxt
(
dataTab
))
commit
:=
t
.
CommitTree
(
tdTxt
)
commit
:=
t
.
CommitTree
(
tdTxt
)
fmt
.
Printf
(
"@%s %s
\n
"
,
commit
.
At
,
commit
.
Tree
)
fmt
.
Printf
(
"@%s %s
\n
"
,
commit
.
At
,
commit
.
Tree
)
...
@@ -170,9 +170,9 @@ func TestΔFtail(t_ *testing.T) {
...
@@ -170,9 +170,9 @@ func TestΔFtail(t_ *testing.T) {
//}
//}
//
blkDataTxt returns string representation of {} blkData
.
//
dataTabTxt returns string representation of {} dataTab
.
//
//
// it is similar to xbtreetest.KVTxt but uses string instead of Key for keys.
// it is similar to xbtreetest.KVTxt but uses string instead of Key for keys.
func
blkData
Txt
(
dataTab
map
[
string
]
string
)
string
{
func
dataTab
Txt
(
dataTab
map
[
string
]
string
)
string
{
panic
(
"TODO"
)
panic
(
"TODO"
)
}
}
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