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
20d53f7a
Commit
20d53f7a
authored
Feb 16, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8cde7ef9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
t/neo/storage/fs1/fsb/fsbtree_util.go
t/neo/storage/fs1/fsb/fsbtree_util.go
+1
-1
t/neo/storage/fs1/fsb/gen-fsbtree
t/neo/storage/fs1/fsb/gen-fsbtree
+1
-0
t/neo/storage/fs1/index_test.go
t/neo/storage/fs1/index_test.go
+25
-1
No files found.
t/neo/storage/fs1/fsb/fsbtree_util.go
View file @
20d53f7a
...
@@ -19,7 +19,7 @@ func isNil(p interface{}) bool {
...
@@ -19,7 +19,7 @@ func isNil(p interface{}) bool {
}
}
return
false
return
false
}
}
func
(
t
*
Tree
)
d
ump
()
string
{
func
(
t
*
Tree
)
D
ump
()
string
{
var
buf
bytes
.
Buffer
var
buf
bytes
.
Buffer
f
:=
strutil
.
IndentFormatter
(
&
buf
,
"
\t
"
)
f
:=
strutil
.
IndentFormatter
(
&
buf
,
"
\t
"
)
...
...
t/neo/storage/fs1/fsb/gen-fsbtree
View file @
20d53f7a
...
@@ -42,6 +42,7 @@ echo >>$out
...
@@ -42,6 +42,7 @@ echo >>$out
sed
-
n
\
sed
-
n
\
-
e
'/^func isNil(/,/^}/p'
\
-
e
'/^func isNil(/,/^}/p'
\
-
e
'/^func.* dump()/,/^}/ {
-
e
'/^func.* dump()/,/^}/ {
s/dump()/Dump()/g
s/v\.k != nil/true/g
s/v\.k != nil/true/g
s/v\.v != nil/(true || \&v != nil)/g
s/v\.v != nil/(true || \&v != nil)/g
p
p
...
...
t/neo/storage/fs1/index_test.go
View file @
20d53f7a
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
package
fs1
package
fs1
import
(
import
(
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"sort"
"sort"
"strings"
"testing"
"testing"
"../../zodb"
"../../zodb"
...
@@ -56,6 +58,9 @@ func treeEqual(a, b *fsb.Tree) bool {
...
@@ -56,6 +58,9 @@ func treeEqual(a, b *fsb.Tree) bool {
return
true
return
true
}
}
defer
ea
.
Close
()
defer
eb
.
Close
()
for
{
for
{
ka
,
va
,
stopa
:=
ea
.
Next
()
ka
,
va
,
stopa
:=
ea
.
Next
()
kb
,
vb
,
stopb
:=
eb
.
Next
()
kb
,
vb
,
stopb
:=
eb
.
Next
()
...
@@ -75,6 +80,24 @@ func treeEqual(a, b *fsb.Tree) bool {
...
@@ -75,6 +80,24 @@ func treeEqual(a, b *fsb.Tree) bool {
return
true
return
true
}
}
func
treeString
(
t
*
fsb
.
Tree
)
string
{
entryv
:=
[]
string
{}
e
,
_
:=
t
.
SeekFirst
()
if
e
!=
nil
{
defer
e
.
Close
()
for
{
k
,
v
,
stop
:=
e
.
Next
()
if
stop
!=
nil
{
break
}
entryv
=
append
(
entryv
,
fmt
.
Sprintf
(
"%v: %v"
,
k
,
v
))
}
}
return
"{"
+
strings
.
Join
(
entryv
,
", "
)
+
"}"
}
func
TestIndexLookup
(
t
*
testing
.
T
)
{
func
TestIndexLookup
(
t
*
testing
.
T
)
{
// the lookup is tested in cznic.b itself
// the lookup is tested in cznic.b itself
// here we only lightly exercise it
// here we only lightly exercise it
...
@@ -161,7 +184,8 @@ func TestIndexSaveLoad(t *testing.T) {
...
@@ -161,7 +184,8 @@ func TestIndexSaveLoad(t *testing.T) {
// XXX is it ok to compare trees via reflect.DeepEqual ?
// XXX is it ok to compare trees via reflect.DeepEqual ?
if
!
treeEqual
(
fsi2
.
Tree
,
fsi
.
Tree
)
{
if
!
treeEqual
(
fsi2
.
Tree
,
fsi
.
Tree
)
{
t
.
Errorf
(
"index load: trees mismatch: %v ; want %v"
,
fsi2
.
Tree
.
dump
(),
fsi
.
Tree
.
dump
())
//t.Errorf("index load: trees mismatch:\nhave: %v\nwant: %v", fsi2.Tree.Dump(), fsi.Tree.Dump())
t
.
Errorf
(
"index load: trees mismatch:
\n
have: %v
\n
want: %v"
,
treeString
(
fsi2
.
Tree
),
treeString
(
fsi
.
Tree
))
}
}
...
...
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