Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
d03fad69
Commit
d03fad69
authored
Jan 04, 2015
by
Juan Batiz-Benet
Browse files
testutil: obvious names for seeded key pairs
parent
f3c490a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
crypto/key_test.go
View file @
d03fad69
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
)
)
func
TestRsaKeys
(
t
*
testing
.
T
)
{
func
TestRsaKeys
(
t
*
testing
.
T
)
{
sk
,
pk
,
err
:=
tu
.
RandKeyPair
(
512
)
sk
,
pk
,
err
:=
tu
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -93,7 +93,7 @@ func testKeyEquals(t *testing.T, k Key) {
...
@@ -93,7 +93,7 @@ func testKeyEquals(t *testing.T, k Key) {
t
.
Fatal
(
"Key not equal to key with same bytes."
)
t
.
Fatal
(
"Key not equal to key with same bytes."
)
}
}
sk
,
pk
,
err
:=
tu
.
RandKeyPair
(
512
)
sk
,
pk
,
err
:=
tu
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
net/mock/mock_net.go
View file @
d03fad69
...
@@ -45,7 +45,7 @@ func New(ctx context.Context) Mocknet {
...
@@ -45,7 +45,7 @@ func New(ctx context.Context) Mocknet {
}
}
func
(
mn
*
mocknet
)
GenPeer
()
(
host
.
Host
,
error
)
{
func
(
mn
*
mocknet
)
GenPeer
()
(
host
.
Host
,
error
)
{
sk
,
_
,
err
:=
testutil
.
SeededKeyPair
(
time
.
Now
()
.
UnixNano
())
sk
,
_
,
err
:=
testutil
.
Seeded
Test
KeyPair
(
time
.
Now
()
.
UnixNano
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
net/mock/mock_test.go
View file @
d03fad69
...
@@ -26,15 +26,15 @@ func randPeer(t *testing.T) peer.ID {
...
@@ -26,15 +26,15 @@ func randPeer(t *testing.T) peer.ID {
func
TestNetworkSetup
(
t
*
testing
.
T
)
{
func
TestNetworkSetup
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
sk1
,
_
,
err
:=
testutil
.
RandKeyPair
(
512
)
sk1
,
_
,
err
:=
testutil
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
t
)
t
.
Fatal
(
t
)
}
}
sk2
,
_
,
err
:=
testutil
.
RandKeyPair
(
512
)
sk2
,
_
,
err
:=
testutil
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
t
)
t
.
Fatal
(
t
)
}
}
sk3
,
_
,
err
:=
testutil
.
RandKeyPair
(
512
)
sk3
,
_
,
err
:=
testutil
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
t
)
t
.
Fatal
(
t
)
}
}
...
@@ -398,7 +398,7 @@ func TestAdding(t *testing.T) {
...
@@ -398,7 +398,7 @@ func TestAdding(t *testing.T) {
peers
:=
[]
peer
.
ID
{}
peers
:=
[]
peer
.
ID
{}
for
i
:=
0
;
i
<
3
;
i
++
{
for
i
:=
0
;
i
<
3
;
i
++
{
sk
,
_
,
err
:=
testutil
.
RandKeyPair
(
512
)
sk
,
_
,
err
:=
testutil
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
peer/peer_test.go
View file @
d03fad69
...
@@ -41,7 +41,7 @@ type keyset struct {
...
@@ -41,7 +41,7 @@ type keyset struct {
func
(
ks
*
keyset
)
generate
()
error
{
func
(
ks
*
keyset
)
generate
()
error
{
var
err
error
var
err
error
ks
.
sk
,
ks
.
pk
,
err
=
tu
.
RandKeyPair
(
512
)
ks
.
sk
,
ks
.
pk
,
err
=
tu
.
Rand
Test
KeyPair
(
512
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
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