Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
ec7dafb1
Commit
ec7dafb1
authored
Aug 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ec54f600
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
go/neo/client/cache_test.go
go/neo/client/cache_test.go
+26
-11
No files found.
go/neo/client/cache_test.go
View file @
ec7dafb1
...
@@ -112,7 +112,7 @@ func TestCache(t *testing.T) {
...
@@ -112,7 +112,7 @@ func TestCache(t *testing.T) {
tc
:=
Checker
{
t
}
tc
:=
Checker
{
t
}
ok1
:=
func
(
v
bool
)
{
t
.
Helper
();
tc
.
ok1
(
v
)
}
ok1
:=
func
(
v
bool
)
{
t
.
Helper
();
tc
.
ok1
(
v
)
}
eq
:=
func
(
a
,
b
interface
{})
{
t
.
Helper
();
tc
.
assertEq
(
a
,
b
)
}
//
eq := func(a, b interface{}) { t.Helper(); tc.assertEq(a, b) }
c
:=
NewCache
(
tstor
)
c
:=
NewCache
(
tstor
)
...
@@ -135,16 +135,35 @@ func TestCache(t *testing.T) {
...
@@ -135,16 +135,35 @@ func TestCache(t *testing.T) {
}
}
}
}
checkRCE
:=
func
(
rce
*
revCacheEntry
,
before
,
serial
zodb
.
Tid
,
data
[]
byte
,
err
error
)
{
t
.
Helper
()
bad
:=
&
bytes
.
Buffer
{}
if
rce
.
before
!=
before
{
fmt
.
Fprintf
(
bad
,
"before:
\n
%s"
,
pretty
.
Compare
(
before
,
rce
.
before
))
}
if
rce
.
serial
!=
serial
{
fmt
.
Fprintf
(
bad
,
"serial:
\n
%s"
,
pretty
.
Compare
(
serial
,
rce
.
serial
))
}
if
!
reflect
.
DeepEqual
(
rce
.
data
,
data
)
{
fmt
.
Fprintf
(
bad
,
"data:
\n
%s"
,
pretty
.
Compare
(
data
,
rce
.
data
))
}
if
!
reflect
.
DeepEqual
(
rce
.
err
,
err
)
{
fmt
.
Fprintf
(
bad
,
"err:
\n
%s"
,
pretty
.
Compare
(
err
,
rce
.
err
))
}
if
bad
.
Len
()
!=
0
{
t
.
Fatalf
(
"rce:
\n
%s"
,
bad
.
Bytes
())
// XXX add oid?
}
}
// load <3 -> new rce entry
// load <3 -> new rce entry
checkLoad
(
xidlt
(
1
,
3
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
3
)})
checkLoad
(
xidlt
(
1
,
3
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
3
)})
//checkOCE(1, rce1_b3)
oce1
:=
c
.
entryMap
[
1
]
oce1
:=
c
.
entryMap
[
1
]
ok1
(
len
(
oce1
.
revv
)
==
1
)
ok1
(
len
(
oce1
.
revv
)
==
1
)
// XXX vvv -> checkRCE ?
rce1_b3
:=
oce1
.
revv
[
0
]
rce1_b3
:=
oce1
.
revv
[
0
]
ok1
(
rce1_b3
.
before
==
3
)
checkRCE
(
rce1_b3
,
3
,
0
,
nil
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
3
)})
ok1
(
rce1_b3
.
serial
==
0
)
eq
(
rce1_b3
.
err
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
3
)})
// load <4 -> <3 merged with <4
// load <4 -> <3 merged with <4
checkLoad
(
xidlt
(
1
,
4
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
checkLoad
(
xidlt
(
1
,
4
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
...
@@ -152,18 +171,14 @@ func TestCache(t *testing.T) {
...
@@ -152,18 +171,14 @@ func TestCache(t *testing.T) {
ok1
(
len
(
oce1
.
revv
)
==
1
)
ok1
(
len
(
oce1
.
revv
)
==
1
)
rce1_b4
:=
oce1
.
revv
[
0
]
rce1_b4
:=
oce1
.
revv
[
0
]
ok1
(
rce1_b4
!=
rce1_b3
)
// rce1_b3 was merged into rce1_b4
ok1
(
rce1_b4
!=
rce1_b3
)
// rce1_b3 was merged into rce1_b4
ok1
(
rce1_b4
.
before
==
4
)
checkRCE
(
rce1_b4
,
4
,
0
,
nil
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
ok1
(
rce1_b4
.
serial
==
0
)
eq
(
rce1_b4
.
err
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
// load <2 -> <2 merged with <4
// load <2 -> <2 merged with <4
checkLoad
(
xidlt
(
1
,
2
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
2
)})
checkLoad
(
xidlt
(
1
,
2
),
nil
,
0
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
2
)})
ok1
(
len
(
oce1
.
revv
)
==
1
)
ok1
(
len
(
oce1
.
revv
)
==
1
)
ok1
(
oce1
.
revv
[
0
]
==
rce1_b4
)
ok1
(
oce1
.
revv
[
0
]
==
rce1_b4
)
ok1
(
rce1_b4
.
before
==
4
)
checkRCE
(
rce1_b4
,
4
,
0
,
nil
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
ok1
(
rce1_b4
.
serial
==
0
)
eq
(
rce1_b4
.
err
,
&
zodb
.
ErrXidMissing
{
xidlt
(
1
,
4
)})
}
}
type
Checker
struct
{
type
Checker
struct
{
...
...
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