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
0d1ba52e
Commit
0d1ba52e
authored
Mar 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e08c206a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
39 deletions
+49
-39
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+49
-39
No files found.
t/neo/storage/fs1/filestorage_test.go
View file @
0d1ba52e
...
...
@@ -15,6 +15,8 @@ package fs1
import
(
"bytes"
"fmt"
"io"
"reflect"
"testing"
...
...
@@ -109,43 +111,52 @@ func TestLoad(t *testing.T) {
// check iterating XXX move to separate test ?
// tids we will use for tid{Min,Max}
tidv
:=
[]
zodb
.
Tid
{
zodb
.
Tid
(
0
)
}
tidv
:=
[]
zodb
.
Tid
{}
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
//tidv = append(tidv, dbe.Header.Tid-1) // XXX here?
tidv
=
append
(
tidv
,
dbe
.
Header
.
Tid
)
//tidv = append(tidv, dbe.Header.Tid+1) // XXX here?
}
tidv
=
append
(
tidv
,
zodb
.
TidMax
)
// XXX i -> iMin, j -> iMax ?
for
i
,
tidMin
:=
range
tidv
{
// TODO test both tidMin, and tidMin - 1
minv
:=
[]
zodb
.
Tid
{
tidMin
-
1
,
tidMin
,
tidMin
+
1
}
for
j
,
tidMax
:=
range
tidv
{
// TODO test both tidMax, and tidMax + 1
_
=
j
// XXX
iter
:=
fs
.
Iterate
(
tidMin
,
tidMax
)
maxv
:=
[]
zodb
.
Tid
{
tidMax
-
1
,
tidMax
,
tidMax
+
1
}
if
tidMin
>
tidMax
{
// expect error / panic or empty iteration ?
}
for
ii
,
tmin
:=
range
minv
{
for
jj
,
tmax
:=
range
maxv
{
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
//txni := zodb.TxnInfo{}
//datai := zodb.StorageRecordInformation{}
// expected number of iteration steps
nsteps
:=
j
-
i
+
1
nsteps
-=
ii
/
2
// one less point for tidMin+1
nsteps
-=
(
2
-
jj
)
/
2
// one less point for tidMax-1
if
nsteps
<
0
{
nsteps
=
0
// j < i and j == i and ii/jj
}
for
k
:=
0
;
;
k
++
{
subj
:=
fmt
.
Sprintf
(
"iterating %v..%v: step %v/%v"
,
tmin
,
tmax
,
k
+
1
,
nsteps
)
if
k
>=
nsteps
{
t
.
Errorf
(
"%v: steps overrun"
,
subj
)
}
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
if
err
!=
nil
{
err
=
okEOF
(
err
)
if
err
==
io
.
EOF
{
if
k
!=
nsteps
-
1
{
t
.
Errorf
(
"%v: steps underrun"
,
subj
)
}
break
}
t
.
Errorf
(
"%v: %v"
,
subj
,
err
)
}
// XXX vvv assumes i < j
// FIXME first tidMin and last tidMax
dbe
:=
_1fs_dbEntryv
[
i
+
k
]
// TODO also check .Pos, .LenPrev, .Len
if
!
reflect
.
DeepEqual
(
*
txni
,
dbe
.
Header
.
TxnInfo
)
{
t
.
Errorf
(
"iterating %v..%v: step %v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
tidMin
,
tidMax
,
k
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
// XXX fatal temp
t
.
Fatalf
(
"%v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
subj
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
}
for
{
...
...
@@ -162,9 +173,8 @@ func TestLoad(t *testing.T) {
}
// TODO check err
}
}
}
}
}
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