mirror of https://github.com/vacp2p/nim-libp2p.git
style/cleanup
This commit is contained in:
parent
e98ec9fd49
commit
468cddeb45
|
@ -1,15 +1,15 @@
|
||||||
import unittest, options
|
import unittest, options
|
||||||
import chronos, strutils, sequtils
|
import chronos, strutils, sequtils
|
||||||
import ../libp2p/protocols/identify,
|
import ../libp2p/[protocols/identify,
|
||||||
../libp2p/multiaddress,
|
multiaddress,
|
||||||
../libp2p/peerinfo,
|
peerinfo,
|
||||||
../libp2p/peer,
|
peer,
|
||||||
../libp2p/connection,
|
connection,
|
||||||
../libp2p/multistream,
|
multistream,
|
||||||
../libp2p/transports/transport,
|
transports/transport,
|
||||||
../libp2p/transports/tcptransport,
|
transports/tcptransport,
|
||||||
../libp2p/protocols/protocol,
|
protocols/protocol,
|
||||||
../libp2p/crypto/crypto
|
crypto/crypto]
|
||||||
|
|
||||||
suite "Identify":
|
suite "Identify":
|
||||||
test "handle identify message":
|
test "handle identify message":
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import unittest, sequtils, sugar, strformat, options, strformat
|
import unittest, sequtils, sugar, strformat, options, strformat
|
||||||
import chronos, nimcrypto/utils, chronicles
|
import chronos, nimcrypto/utils, chronicles
|
||||||
import ../libp2p/connection,
|
import ../libp2p/[connection,
|
||||||
../libp2p/stream/lpstream,
|
stream/lpstream,
|
||||||
../libp2p/stream/bufferstream,
|
stream/bufferstream,
|
||||||
../libp2p/transports/tcptransport,
|
transports/tcptransport,
|
||||||
../libp2p/transports/transport,
|
transports/transport,
|
||||||
../libp2p/protocols/identify,
|
protocols/identify,
|
||||||
../libp2p/multiaddress,
|
multiaddress,
|
||||||
../libp2p/muxers/mplex/mplex,
|
muxers/mplex/mplex,
|
||||||
../libp2p/muxers/mplex/coder,
|
muxers/mplex/coder,
|
||||||
../libp2p/muxers/mplex/types,
|
muxers/mplex/types,
|
||||||
../libp2p/muxers/mplex/lpchannel
|
muxers/mplex/lpchannel]
|
||||||
|
|
||||||
suite "Mplex":
|
suite "Mplex":
|
||||||
test "encode header with channel id 0":
|
test "encode header with channel id 0":
|
||||||
|
|
|
@ -114,14 +114,14 @@ suite "PubSub":
|
||||||
check:
|
check:
|
||||||
waitFor(testBasicPubSub()) == true
|
waitFor(testBasicPubSub()) == true
|
||||||
|
|
||||||
test "basic FloodSub":
|
test "FloodSub multiple peers":
|
||||||
proc testBasicFloodSub(): Future[bool] {.async.} =
|
proc testBasicFloodSub(): Future[bool] {.async.} =
|
||||||
var passed: int
|
var passed: int
|
||||||
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
||||||
check topic == "foobar"
|
check topic == "foobar"
|
||||||
passed.inc()
|
passed.inc()
|
||||||
|
|
||||||
var nodes: seq[Switch] = generateNodes(20)
|
var nodes: seq[Switch] = generateNodes(10)
|
||||||
var awaitters: seq[Future[void]]
|
var awaitters: seq[Future[void]]
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
awaitters.add(await node.start())
|
awaitters.add(await node.start())
|
||||||
|
@ -138,7 +138,7 @@ suite "PubSub":
|
||||||
await allFutures(nodes.mapIt(it.stop()))
|
await allFutures(nodes.mapIt(it.stop()))
|
||||||
await allFutures(awaitters)
|
await allFutures(awaitters)
|
||||||
|
|
||||||
result = passed == 20
|
result = passed == 10
|
||||||
|
|
||||||
check:
|
check:
|
||||||
waitFor(testBasicFloodSub()) == true
|
waitFor(testBasicFloodSub()) == true
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import unittest
|
import unittest
|
||||||
import chronos
|
import chronos
|
||||||
import ../libp2p/connection,
|
import ../libp2p/[connection,
|
||||||
../libp2p/transports/transport,
|
transports/transport,
|
||||||
../libp2p/transports/tcptransport,
|
transports/tcptransport,
|
||||||
../libp2p/multiaddress,
|
multiaddress,
|
||||||
../libp2p/wire
|
wire]
|
||||||
|
|
||||||
suite "TCP transport":
|
suite "TCP transport":
|
||||||
test "test listener: handle write":
|
test "test listener: handle write":
|
||||||
|
|
Loading…
Reference in New Issue