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-cid
Commits
f60e346b
Commit
f60e346b
authored
Oct 13, 2020
by
Rod Vagg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverage: more tests for builder
parent
8647a1d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
builder_test.go
builder_test.go
+20
-0
No files found.
builder_test.go
View file @
f60e346b
...
@@ -65,9 +65,29 @@ func TestCodecChange(t *testing.T) {
...
@@ -65,9 +65,29 @@ func TestCodecChange(t *testing.T) {
p := Prefix{Version: 1, Codec: DagProtobuf, MhType: mh.SHA2_256, MhLength: mh.DefaultLengths[mh.SHA2_256]}
p := Prefix{Version: 1, Codec: DagProtobuf, MhType: mh.SHA2_256, MhLength: mh.DefaultLengths[mh.SHA2_256]}
testCodecChange(t, p)
testCodecChange(t, p)
})
})
t.Run(
"Prefix-NoChange"
,
func
(t *testing.T) {
p := Prefix{Version: 0, Codec: DagProtobuf, MhType: mh.SHA2_256, MhLength: mh.DefaultLengths[mh.SHA2_256]}
if
p.GetCodec() != DagProtobuf {
t.Fatal(
"original builder not using Protobuf codec"
)
}
pn := p.WithCodec(DagProtobuf)
if
pn != p {
t.Fatal(
"should have returned same builder"
)
}
})
t.Run(
"V0Builder"
,
func
(t *testing.T) {
t.Run(
"V0Builder"
,
func
(t *testing.T) {
testCodecChange(t, V0Builder{})
testCodecChange(t, V0Builder{})
})
})
t.Run(
"V0Builder-NoChange"
,
func
(t *testing.T) {
b := V0Builder{}
if
b.GetCodec() != DagProtobuf {
t.Fatal(
"original builder not using Protobuf codec"
)
}
bn := b.WithCodec(DagProtobuf)
if
bn != b {
t.Fatal(
"should have returned same builder"
)
}
})
t.Run(
"V1Builder"
,
func
(t *testing.T) {
t.Run(
"V1Builder"
,
func
(t *testing.T) {
testCodecChange(t, V1Builder{Codec: DagProtobuf, MhType: mh.SHA2_256})
testCodecChange(t, V1Builder{Codec: DagProtobuf, MhType: mh.SHA2_256})
})
})
...
...
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