Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
e671ab2f
提交
e671ab2f
authored
6月 03, 2015
作者:
rht
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Swap all 'crypto/rand' rng in tests with 'math/rand'
上级
c14ab9bd
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
12 行增加
和
14 行删除
+12
-14
ipns_test.go
fuse/ipns/ipns_test.go
+2
-2
balanced_test.go
importer/balanced/balanced_test.go
+1
-2
splitting_test.go
importer/chunk/splitting_test.go
+3
-2
trickle_test.go
importer/trickle/trickle_test.go
+1
-2
backpressure_test.go
p2p/test/backpressure/backpressure_test.go
+2
-2
reconnect_test.go
p2p/test/reconnects/reconnect_test.go
+2
-2
gen.go
util/testutil/gen.go
+1
-2
没有找到文件。
fuse/ipns/ipns_test.go
浏览文件 @
e671ab2f
...
@@ -4,7 +4,6 @@ package ipns
...
@@ -4,7 +4,6 @@ package ipns
import
(
import
(
"bytes"
"bytes"
"crypto/rand"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
mrand
"math/rand"
mrand
"math/rand"
...
@@ -19,6 +18,7 @@ import (
...
@@ -19,6 +18,7 @@ import (
core
"github.com/ipfs/go-ipfs/core"
core
"github.com/ipfs/go-ipfs/core"
coremock
"github.com/ipfs/go-ipfs/core/mock"
coremock
"github.com/ipfs/go-ipfs/core/mock"
nsfs
"github.com/ipfs/go-ipfs/ipnsfs"
nsfs
"github.com/ipfs/go-ipfs/ipnsfs"
u
"github.com/ipfs/go-ipfs/util"
ci
"github.com/ipfs/go-ipfs/util/testutil/ci"
ci
"github.com/ipfs/go-ipfs/util/testutil/ci"
)
)
...
@@ -30,7 +30,7 @@ func maybeSkipFuseTests(t *testing.T) {
...
@@ -30,7 +30,7 @@ func maybeSkipFuseTests(t *testing.T) {
func
randBytes
(
size
int
)
[]
byte
{
func
randBytes
(
size
int
)
[]
byte
{
b
:=
make
([]
byte
,
size
)
b
:=
make
([]
byte
,
size
)
rand
.
Read
(
b
)
u
.
NewTimeSeededRand
()
.
Read
(
b
)
return
b
return
b
}
}
...
...
importer/balanced/balanced_test.go
浏览文件 @
e671ab2f
...
@@ -2,7 +2,6 @@ package balanced
...
@@ -2,7 +2,6 @@ package balanced
import
(
import
(
"bytes"
"bytes"
"crypto/rand"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
...
@@ -130,7 +129,7 @@ func TestRabinBlockSize(t *testing.T) {
...
@@ -130,7 +129,7 @@ func TestRabinBlockSize(t *testing.T) {
}
}
buf
:=
new
(
bytes
.
Buffer
)
buf
:=
new
(
bytes
.
Buffer
)
nbytes
:=
1024
*
1024
nbytes
:=
1024
*
1024
io
.
CopyN
(
buf
,
rand
.
Reader
,
int64
(
nbytes
))
io
.
CopyN
(
buf
,
u
.
NewTimeSeededRand
()
,
int64
(
nbytes
))
rab
:=
chunk
.
NewMaybeRabin
(
4096
)
rab
:=
chunk
.
NewMaybeRabin
(
4096
)
blkch
:=
rab
.
Split
(
buf
)
blkch
:=
rab
.
Split
(
buf
)
...
...
importer/chunk/splitting_test.go
浏览文件 @
e671ab2f
...
@@ -2,14 +2,15 @@ package chunk
...
@@ -2,14 +2,15 @@ package chunk
import
(
import
(
"bytes"
"bytes"
"crypto/rand"
"io"
"io"
"testing"
"testing"
u
"github.com/ipfs/go-ipfs/util"
)
)
func
randBuf
(
t
*
testing
.
T
,
size
int
)
[]
byte
{
func
randBuf
(
t
*
testing
.
T
,
size
int
)
[]
byte
{
buf
:=
make
([]
byte
,
size
)
buf
:=
make
([]
byte
,
size
)
if
_
,
err
:=
rand
.
Read
(
buf
);
err
!=
nil
{
if
_
,
err
:=
u
.
NewTimeSeededRand
()
.
Read
(
buf
);
err
!=
nil
{
t
.
Fatal
(
"failed to read enough randomness"
)
t
.
Fatal
(
"failed to read enough randomness"
)
}
}
return
buf
return
buf
...
...
importer/trickle/trickle_test.go
浏览文件 @
e671ab2f
...
@@ -2,7 +2,6 @@ package trickle
...
@@ -2,7 +2,6 @@ package trickle
import
(
import
(
"bytes"
"bytes"
"crypto/rand"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
...
@@ -136,7 +135,7 @@ func TestRabinBlockSize(t *testing.T) {
...
@@ -136,7 +135,7 @@ func TestRabinBlockSize(t *testing.T) {
}
}
buf
:=
new
(
bytes
.
Buffer
)
buf
:=
new
(
bytes
.
Buffer
)
nbytes
:=
1024
*
1024
nbytes
:=
1024
*
1024
io
.
CopyN
(
buf
,
rand
.
Reader
,
int64
(
nbytes
))
io
.
CopyN
(
buf
,
u
.
NewTimeSeededRand
()
,
int64
(
nbytes
))
rab
:=
chunk
.
NewMaybeRabin
(
4096
)
rab
:=
chunk
.
NewMaybeRabin
(
4096
)
blkch
:=
rab
.
Split
(
buf
)
blkch
:=
rab
.
Split
(
buf
)
...
...
p2p/test/backpressure/backpressure_test.go
浏览文件 @
e671ab2f
package
backpressure_tests
package
backpressure_tests
import
(
import
(
crand
"crypto/rand"
"io"
"io"
"math/rand"
"math/rand"
"testing"
"testing"
...
@@ -15,6 +14,7 @@ import (
...
@@ -15,6 +14,7 @@ import (
eventlog
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
eventlog
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
u
"github.com/ipfs/go-ipfs/util"
)
)
var
log
=
eventlog
.
Logger
(
"backpressure"
)
var
log
=
eventlog
.
Logger
(
"backpressure"
)
...
@@ -236,7 +236,7 @@ func TestStBackpressureStreamWrite(t *testing.T) {
...
@@ -236,7 +236,7 @@ func TestStBackpressureStreamWrite(t *testing.T) {
// ready a buffer of random data
// ready a buffer of random data
buf
:=
make
([]
byte
,
65536
)
buf
:=
make
([]
byte
,
65536
)
crand
.
Read
(
buf
)
u
.
NewTimeSeededRand
()
.
Read
(
buf
)
for
{
for
{
// send a randomly sized subchunk
// send a randomly sized subchunk
...
...
p2p/test/reconnects/reconnect_test.go
浏览文件 @
e671ab2f
package
reconnect
package
reconnect
import
(
import
(
crand
"crypto/rand"
"io"
"io"
"math/rand"
"math/rand"
"sync"
"sync"
...
@@ -14,6 +13,7 @@ import (
...
@@ -14,6 +13,7 @@ import (
protocol
"github.com/ipfs/go-ipfs/p2p/protocol"
protocol
"github.com/ipfs/go-ipfs/p2p/protocol"
testutil
"github.com/ipfs/go-ipfs/p2p/test/util"
testutil
"github.com/ipfs/go-ipfs/p2p/test/util"
eventlog
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
eventlog
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
u
"github.com/ipfs/go-ipfs/util"
ps
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
ps
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
...
@@ -66,7 +66,7 @@ func newSender() (chan sendChans, func(s inet.Stream)) {
...
@@ -66,7 +66,7 @@ func newSender() (chan sendChans, func(s inet.Stream)) {
buf
:=
make
([]
byte
,
65536
)
buf
:=
make
([]
byte
,
65536
)
buf2
:=
make
([]
byte
,
65536
)
buf2
:=
make
([]
byte
,
65536
)
crand
.
Read
(
buf
)
u
.
NewTimeSeededRand
()
.
Read
(
buf
)
for
{
for
{
select
{
select
{
...
...
util/testutil/gen.go
浏览文件 @
e671ab2f
...
@@ -2,7 +2,6 @@ package testutil
...
@@ -2,7 +2,6 @@ package testutil
import
(
import
(
"bytes"
"bytes"
crand
"crypto/rand"
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
...
@@ -44,7 +43,7 @@ func SeededTestKeyPair(seed int64) (ci.PrivKey, ci.PubKey, error) {
...
@@ -44,7 +43,7 @@ func SeededTestKeyPair(seed int64) (ci.PrivKey, ci.PubKey, error) {
// id, _ := peer.IDFromPublicKey(pk)
// id, _ := peer.IDFromPublicKey(pk)
func
RandPeerID
()
(
peer
.
ID
,
error
)
{
func
RandPeerID
()
(
peer
.
ID
,
error
)
{
buf
:=
make
([]
byte
,
16
)
buf
:=
make
([]
byte
,
16
)
if
_
,
err
:=
io
.
ReadFull
(
crand
.
Reader
,
buf
);
err
!=
nil
{
if
_
,
err
:=
io
.
ReadFull
(
u
.
NewTimeSeededRand
()
,
buf
);
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
h
:=
u
.
Hash
(
buf
)
h
:=
u
.
Hash
(
buf
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论