Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
77e9b8dd
Commit
77e9b8dd
authored
Aug 08, 2017
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for alternative hash function in Dag Modifier.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
2e15dcb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
unixfs/mod/dagmodifier_test.go
unixfs/mod/dagmodifier_test.go
+1
-0
unixfs/test/utils.go
unixfs/test/utils.go
+8
-0
No files found.
unixfs/mod/dagmodifier_test.go
View file @
77e9b8dd
...
...
@@ -77,6 +77,7 @@ func runAllSubtests(t *testing.T, tfunc func(*testing.T, testu.NodeOpts)) {
t
.
Run
(
"opts=ProtoBufLeaves"
,
func
(
t
*
testing
.
T
)
{
tfunc
(
t
,
testu
.
UseProtoBufLeaves
)
})
t
.
Run
(
"opts=RawLeaves"
,
func
(
t
*
testing
.
T
)
{
tfunc
(
t
,
testu
.
UseRawLeaves
)
})
t
.
Run
(
"opts=CidV1"
,
func
(
t
*
testing
.
T
)
{
tfunc
(
t
,
testu
.
UseCidV1
)
})
t
.
Run
(
"opts=Blake2b256"
,
func
(
t
*
testing
.
T
)
{
tfunc
(
t
,
testu
.
UseBlake2b256
)
})
}
func
TestDagModifierBasic
(
t
*
testing
.
T
)
{
...
...
unixfs/test/utils.go
View file @
77e9b8dd
...
...
@@ -18,6 +18,7 @@ import (
cid
"gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid"
node
"gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format"
u
"gx/ipfs/QmSU6eubNdhXjFBJBSksTp8kv8YRub8mGAPv8tVJHmL2EU/go-ipfs-util"
mh
"gx/ipfs/QmU9a9NV9RdPNwZQDYd5uKsm6N6LJLSvLbywDDYFbaaC6P/go-multihash"
)
func
SizeSplitterGen
(
size
int64
)
chunk
.
SplitterGen
{
...
...
@@ -41,6 +42,13 @@ type NodeOpts struct {
var
UseProtoBufLeaves
=
NodeOpts
{
Prefix
:
mdag
.
V0CidPrefix
()}
var
UseRawLeaves
=
NodeOpts
{
Prefix
:
mdag
.
V0CidPrefix
(),
ForceRawLeaves
:
true
,
RawLeavesUsed
:
true
}
var
UseCidV1
=
NodeOpts
{
Prefix
:
mdag
.
V1CidPrefix
(),
RawLeavesUsed
:
true
}
var
UseBlake2b256
NodeOpts
func
init
()
{
UseBlake2b256
=
UseCidV1
UseBlake2b256
.
Prefix
.
MhType
=
mh
.
Names
[
"blake2b-256"
]
UseBlake2b256
.
Prefix
.
MhLength
=
-
1
}
func
GetNode
(
t
testing
.
TB
,
dserv
mdag
.
DAGService
,
data
[]
byte
,
opts
NodeOpts
)
node
.
Node
{
in
:=
bytes
.
NewReader
(
data
)
...
...
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