mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2024-12-28 23:50:12 +08:00
c04ff2d27b
License: MIT Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
39 lines
828 B
Go
39 lines
828 B
Go
package pstoremem
|
|
|
|
import (
|
|
"testing"
|
|
|
|
pstore "github.com/libp2p/go-libp2p-peerstore"
|
|
pt "github.com/libp2p/go-libp2p-peerstore/test"
|
|
)
|
|
|
|
func TestInMemoryPeerstore(t *testing.T) {
|
|
pt.TestPeerstore(t, func() (pstore.Peerstore, func()) {
|
|
return NewPeerstore(), nil
|
|
})
|
|
}
|
|
|
|
func TestInMemoryAddrBook(t *testing.T) {
|
|
pt.TestAddrBook(t, func() (pstore.AddrBook, func()) {
|
|
return NewAddrBook(), nil
|
|
})
|
|
}
|
|
|
|
func TestInMemoryKeyBook(t *testing.T) {
|
|
pt.TestKeyBook(t, func() (pstore.KeyBook, func()) {
|
|
return NewKeyBook(), nil
|
|
})
|
|
}
|
|
|
|
func BenchmarkInMemoryPeerstore(b *testing.B) {
|
|
pt.BenchmarkPeerstore(b, func() (pstore.Peerstore, func()) {
|
|
return NewPeerstore(), nil
|
|
}, "InMem")
|
|
}
|
|
|
|
func BenchmarkInMemoryKeyBook(b *testing.B) {
|
|
pt.BenchmarkKeyBook(b, func() (pstore.KeyBook, func()) {
|
|
return NewKeyBook(), nil
|
|
})
|
|
}
|