Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
cfd7e74c
Commit
cfd7e74c
authored
Nov 26, 2014
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: add test for NewPeer
parent
3a09459c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
peer_test.go
p2p/peer_test.go
+15
-0
No files found.
p2p/peer_test.go
View file @
cfd7e74c
...
...
@@ -6,6 +6,7 @@ import (
"encoding/hex"
"io/ioutil"
"net"
"reflect"
"testing"
"time"
)
...
...
@@ -222,3 +223,17 @@ func TestPeerActivity(t *testing.T) {
t
.
Fatal
(
"peer error"
,
err
)
}
}
func
TestNewPeer
(
t
*
testing
.
T
)
{
id
:=
NewSimpleClientIdentity
(
"clientid"
,
"version"
,
"customid"
,
"pubkey"
)
caps
:=
[]
Cap
{{
"foo"
,
2
},
{
"bar"
,
3
}}
p
:=
NewPeer
(
id
,
caps
)
if
!
reflect
.
DeepEqual
(
p
.
Caps
(),
caps
)
{
t
.
Errorf
(
"Caps mismatch: got %v, expected %v"
,
p
.
Caps
(),
caps
)
}
if
p
.
Identity
()
!=
id
{
t
.
Errorf
(
"Identity mismatch: got %v, expected %v"
,
p
.
Identity
(),
id
)
}
// Should not hang.
p
.
Disconnect
(
DiscAlreadyConnected
)
}
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