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
f758e76d
Commit
f758e76d
authored
Oct 27, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(bitswap/message) no duplicates
parent
8cd17e8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
message/message_test.go
message/message_test.go
+17
-0
No files found.
message/message_test.go
View file @
f758e76d
...
@@ -169,3 +169,20 @@ func contains(s []string, x string) bool {
...
@@ -169,3 +169,20 @@ func contains(s []string, x string) bool {
}
}
return
false
return
false
}
}
func
TestDuplicates
(
t
*
testing
.
T
)
{
b
:=
blocks
.
NewBlock
([]
byte
(
"foo"
))
msg
:=
New
()
msg
.
AddWanted
(
b
.
Key
())
msg
.
AddWanted
(
b
.
Key
())
if
len
(
msg
.
Wantlist
())
!=
1
{
t
.
Fatal
(
"Duplicate in BitSwapMessage"
)
}
msg
.
AddBlock
(
*
b
)
msg
.
AddBlock
(
*
b
)
if
len
(
msg
.
Blocks
())
!=
1
{
t
.
Fatal
(
"Duplicate in BitSwapMessage"
)
}
}
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