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
324241eb
Commit
324241eb
authored
Jun 24, 2021
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X rebuild: tests: Don't reflect.DeepEqual in inner loop
154s -> 130s
parent
086ae670
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+2
-0
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+39
-2
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
324241eb
...
...
@@ -184,6 +184,7 @@ func (orig *ΔBtail) Clone() *ΔBtail {
}
// vδBroots
klon
.
vδBroots
=
make
([]
ΔBroots
,
0
,
len
(
orig
.
vδBroots
))
for
_
,
origδBroots
:=
range
orig
.
vδBroots
{
klonδBroots
:=
ΔBroots
{
Rev
:
origδBroots
.
Rev
,
...
...
@@ -208,6 +209,7 @@ func (orig *ΔBtail) Clone() *ΔBtail {
// Clone returns copy of ΔTtail.
func
(
orig
*
ΔTtail
)
Clone
()
*
ΔTtail
{
klon
:=
&
ΔTtail
{}
klon
.
vδT
=
make
([]
ΔTree
,
0
,
len
(
orig
.
vδT
))
for
_
,
origδT
:=
range
orig
.
vδT
{
klonδT
:=
ΔTree
{
Rev
:
origδT
.
Rev
,
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
324241eb
...
...
@@ -1148,7 +1148,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
if
len
(
δB
.
ΔByRoot
)
!=
δrootsOK
{
t
.
Errorf
(
"%s: len(δB.ΔByRoot) != %d ; δroots=%v"
,
subj
,
δrootsOK
,
δroots
)
}
if
!
reflect
.
Deep
Equal
(
δT
,
δTok
)
{
if
!
δT
Equal
(
δT
,
δTok
)
{
t
.
Errorf
(
"%s: δB.ΔBByRoot[%s]:
\n
have: %v
\n
want: %v"
,
subj
,
treeRoot
,
δT
,
δTok
)
}
}
...
...
@@ -1210,7 +1210,7 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *tTreeCommit,
atPrev
=
δToid
.
Rev
}
if
!
(
reflect
.
DeepEqual
(
vat
,
vatOK
)
&&
reflect
.
Deep
Equal
(
vδT
,
vδTok
))
{
if
!
(
tidvEqual
(
vat
,
vatOK
)
&&
vδT
Equal
(
vδT
,
vδTok
))
{
have
:=
""
for
i
:=
0
;
i
<
len
(
vδT
);
i
++
{
have
+=
fmt
.
Sprintf
(
"
\n\t
@%s: %v"
,
xat
[
vat
[
i
]],
vδT
[
i
])
...
...
@@ -2065,6 +2065,43 @@ func (b *RBucket) String() string {
}
// XXX place
func
tidvEqual
(
av
,
bv
[]
zodb
.
Tid
)
bool
{
if
len
(
av
)
!=
len
(
bv
)
{
return
false
}
for
i
,
a
:=
range
av
{
if
bv
[
i
]
!=
a
{
return
false
}
}
return
true
}
func
vδTEqual
(
vδa
,
vδb
[]
map
[
Key
]
Δstring
)
bool
{
if
len
(
vδa
)
!=
len
(
vδb
)
{
return
false
}
for
i
,
δa
:=
range
vδa
{
if
!
δTEqual
(
δa
,
vδb
[
i
])
{
return
false
}
}
return
true
}
func
δTEqual
(
δa
,
δb
map
[
Key
]
Δstring
)
bool
{
if
len
(
δa
)
!=
len
(
δb
)
{
return
false
}
for
k
,
δ
:=
range
δa
{
δ_
,
ok
:=
δb
[
k
]
if
!
ok
||
δ
!=
δ_
{
return
false
}
}
return
true
}
// ----------------------------------------
...
...
Kirill Smelkov
@kirr
mentioned in commit
305d897b
·
Oct 27, 2021
mentioned in commit
305d897b
mentioned in commit 305d897b15ac0866de464de36b34c1fe1de90a63
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
2ab4be93
·
Oct 28, 2021
mentioned in commit
2ab4be93
mentioned in commit 2ab4be938541c61bf881216bdffc5376241ccc30
Toggle commit list
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