2018-09-05 01:07:44 +08:00
|
|
|
package pstoremem
|
2018-08-30 20:44:50 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-08-30 21:13:27 +08:00
|
|
|
pstore "github.com/libp2p/go-libp2p-peerstore"
|
2018-09-08 01:46:23 +08:00
|
|
|
pt "github.com/libp2p/go-libp2p-peerstore/test"
|
2018-08-30 20:44:50 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestInMemoryPeerstore(t *testing.T) {
|
2018-09-08 01:46:23 +08:00
|
|
|
pt.TestPeerstore(t, func() (pstore.Peerstore, func()) {
|
2018-08-30 20:44:50 +08:00
|
|
|
return NewPeerstore(), nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-09-05 22:08:33 +08:00
|
|
|
func TestInMemoryAddrBook(t *testing.T) {
|
2018-09-08 01:46:23 +08:00
|
|
|
pt.TestAddrBook(t, func() (pstore.AddrBook, func()) {
|
2018-08-30 23:43:40 +08:00
|
|
|
return NewAddrBook(), nil
|
2018-08-30 20:44:50 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-08-31 19:59:46 +08:00
|
|
|
func TestInMemoryKeyBook(t *testing.T) {
|
2018-09-08 01:46:23 +08:00
|
|
|
pt.TestKeyBook(t, func() (pstore.KeyBook, func()) {
|
2018-08-31 19:59:46 +08:00
|
|
|
return NewKeyBook(), nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:44:50 +08:00
|
|
|
func BenchmarkInMemoryPeerstore(b *testing.B) {
|
2018-09-08 01:46:23 +08:00
|
|
|
pt.BenchmarkPeerstore(b, func() (pstore.Peerstore, func()) {
|
2018-08-30 20:44:50 +08:00
|
|
|
return NewPeerstore(), nil
|
2018-09-04 18:34:55 +08:00
|
|
|
}, "InMem")
|
2018-08-30 21:13:27 +08:00
|
|
|
}
|
2018-10-29 18:17:10 +08:00
|
|
|
|
|
|
|
func BenchmarkInMemoryKeyBook(b *testing.B) {
|
|
|
|
pt.BenchmarkKeyBook(b, func() (pstore.KeyBook, func()) {
|
|
|
|
return NewKeyBook(), nil
|
|
|
|
})
|
|
|
|
}
|