Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
b95933e0
Commit
b95933e0
authored
Jul 30, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
482dd563
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
9 deletions
+43
-9
go/zodb/btree/btree_test.go
go/zodb/btree/btree_test.go
+38
-2
go/zodb/btree/py/gen-testdata
go/zodb/btree/py/gen-testdata
+2
-2
go/zodb/btree/testdata/1.fs
go/zodb/btree/testdata/1.fs
+0
-0
go/zodb/btree/ztestdata_expect_test.go
go/zodb/btree/ztestdata_expect_test.go
+3
-5
No files found.
go/zodb/btree/btree_test.go
View file @
b95933e0
...
@@ -22,17 +22,53 @@ package btree
...
@@ -22,17 +22,53 @@ package btree
//go:generate ./py/gen-testdata
//go:generate ./py/gen-testdata
import
(
import
(
"context"
"testing"
"testing"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/zodb"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
)
)
// kv is one (key, value) pair.
type
kv
struct
{
type
kv
struct
{
key
int64
key
KEY
value
interface
{}
value
interface
{}
}
}
// testEntry is information about 1 Bucket or BTree (XXX) object.
type
testEntry
struct
{
type
testEntry
struct
{
oid
zodb
.
Oid
oid
zodb
.
Oid
itemv
[]
kv
itemv
[]
kv
}
}
// TODO
func
TestBucket
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
stor
,
err
:=
zodb
.
OpenStorage
(
ctx
,
"testdata/1.fs"
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
db
:=
zodb
.
NewDB
(
stor
)
txn
,
ctx
:=
transaction
.
New
(
ctx
)
defer
txn
.
Abort
()
conn
,
err
:=
db
.
Open
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
for
_
,
tt
:=
range
_1fs_testEntry
{
xobj
,
err
:=
conn
.
Get
(
ctx
,
tt
.
oid
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
obj
,
ok
:=
xobj
.
(
*
Bucket
)
if
!
ok
{
t
.
Fatalf
(
"%s: got %T; want Bucket"
,
tt
.
oid
,
xobj
)
}
_
=
obj
}
}
go/zodb/btree/py/gen-testdata
View file @
b95933e0
...
@@ -45,7 +45,7 @@ def main():
...
@@ -45,7 +45,7 @@ def main():
print
>>
f
,
v
print
>>
f
,
v
emit
(
"// Code generated by %s; DO NOT EDIT."
%
__file__
)
emit
(
"// Code generated by %s; DO NOT EDIT."
%
__file__
)
emit
(
"package btree
\
n
"
)
emit
(
"package btree
\
n
"
)
emit
(
"import
\
"
lab.nexedi.com/kirr/neo/go/zodb
\
"
\
n
"
)
#
emit("import \"lab.nexedi.com/kirr/neo/go/zodb\"\n")
emit
(
"
\
n
var _1fs_testEntry = [...]testEntry{"
)
emit
(
"
\
n
var _1fs_testEntry = [...]testEntry{"
)
for
b
in
(
b0
,
b1
,
b2
):
for
b
in
(
b0
,
b1
,
b2
):
...
@@ -54,7 +54,7 @@ def main():
...
@@ -54,7 +54,7 @@ def main():
if
isinstance
(
v
,
str
):
if
isinstance
(
v
,
str
):
v
=
qq
(
v
)
v
=
qq
(
v
)
s
+=
"{%s, %s}, "
%
(
k
,
v
)
s
+=
"{%s, %s}, "
%
(
k
,
v
)
s
+=
"},"
s
+=
"}
}
,"
emit
(
"
\
t
"
+
s
)
emit
(
"
\
t
"
+
s
)
emit
(
"}"
)
emit
(
"}"
)
...
...
go/zodb/btree/testdata/1.fs
View file @
b95933e0
No preview for this file type
go/zodb/btree/ztestdata_expect_test.go
View file @
b95933e0
// Code generated by ./py/gen-testdata; DO NOT EDIT.
// Code generated by ./py/gen-testdata; DO NOT EDIT.
package
btree
package
btree
import
"lab.nexedi.com/kirr/neo/go/zodb"
var
_1fs_testEntry
=
[
...
]
testEntry
{
var
_1fs_testEntry
=
[
...
]
testEntry
{
testEntry
{
oid
:
1
,
itemv
:
[]
kv
{},
testEntry
{
oid
:
1
,
itemv
:
[]
kv
{}
}
,
testEntry
{
oid
:
2
,
itemv
:
[]
kv
{{
10
,
17
},
},
testEntry
{
oid
:
2
,
itemv
:
[]
kv
{{
10
,
17
},
}
}
,
testEntry
{
oid
:
3
,
itemv
:
[]
kv
{{
15
,
1
},
{
23
,
"hello"
},
},
testEntry
{
oid
:
3
,
itemv
:
[]
kv
{{
15
,
1
},
{
23
,
"hello"
},
}
}
,
}
}
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