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-bitswap
Commits
03e6d1f0
Unverified
Commit
03e6d1f0
authored
Mar 19, 2020
by
Steven Allen
Committed by
GitHub
Mar 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(message): test custom CID type (#309)
This got dropped from my other patch.
parent
21d88348
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
message/pb/cid_test.go
message/pb/cid_test.go
+32
-0
No files found.
message/pb/cid_test.go
0 → 100644
View file @
03e6d1f0
package
bitswap_message_pb_test
import
(
"bytes"
"testing"
"github.com/ipfs/go-cid"
u
"github.com/ipfs/go-ipfs-util"
pb
"github.com/ipfs/go-bitswap/message/pb"
)
func
TestCID
(
t
*
testing
.
T
)
{
var
expected
=
[
...
]
byte
{
10
,
34
,
18
,
32
,
195
,
171
,
143
,
241
,
55
,
32
,
232
,
173
,
144
,
71
,
221
,
57
,
70
,
107
,
60
,
137
,
116
,
229
,
146
,
194
,
250
,
56
,
61
,
74
,
57
,
96
,
113
,
76
,
174
,
240
,
196
,
242
,
}
c
:=
cid
.
NewCidV0
(
u
.
Hash
([]
byte
(
"foobar"
)))
msg
:=
pb
.
Message_BlockPresence
{
Cid
:
pb
.
Cid
{
Cid
:
c
}}
actual
,
err
:=
msg
.
Marshal
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
!
bytes
.
Equal
(
actual
,
expected
[
:
])
{
t
.
Fatal
(
"failed to correctly encode custom CID type"
)
}
}
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