style/cleanup

This commit is contained in:
Dmitriy Ryajov 2019-10-03 13:30:22 -06:00
parent e98ec9fd49
commit 468cddeb45
4 changed files with 29 additions and 29 deletions

View File

@ -1,15 +1,15 @@
import unittest, options
import chronos, strutils, sequtils
import ../libp2p/protocols/identify,
../libp2p/multiaddress,
../libp2p/peerinfo,
../libp2p/peer,
../libp2p/connection,
../libp2p/multistream,
../libp2p/transports/transport,
../libp2p/transports/tcptransport,
../libp2p/protocols/protocol,
../libp2p/crypto/crypto
import ../libp2p/[protocols/identify,
multiaddress,
peerinfo,
peer,
connection,
multistream,
transports/transport,
transports/tcptransport,
protocols/protocol,
crypto/crypto]
suite "Identify":
test "handle identify message":

View File

@ -1,16 +1,16 @@
import unittest, sequtils, sugar, strformat, options, strformat
import chronos, nimcrypto/utils, chronicles
import ../libp2p/connection,
../libp2p/stream/lpstream,
../libp2p/stream/bufferstream,
../libp2p/transports/tcptransport,
../libp2p/transports/transport,
../libp2p/protocols/identify,
../libp2p/multiaddress,
../libp2p/muxers/mplex/mplex,
../libp2p/muxers/mplex/coder,
../libp2p/muxers/mplex/types,
../libp2p/muxers/mplex/lpchannel
import ../libp2p/[connection,
stream/lpstream,
stream/bufferstream,
transports/tcptransport,
transports/transport,
protocols/identify,
multiaddress,
muxers/mplex/mplex,
muxers/mplex/coder,
muxers/mplex/types,
muxers/mplex/lpchannel]
suite "Mplex":
test "encode header with channel id 0":

View File

@ -114,14 +114,14 @@ suite "PubSub":
check:
waitFor(testBasicPubSub()) == true
test "basic FloodSub":
test "FloodSub multiple peers":
proc testBasicFloodSub(): Future[bool] {.async.} =
var passed: int
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
check topic == "foobar"
passed.inc()
var nodes: seq[Switch] = generateNodes(20)
var nodes: seq[Switch] = generateNodes(10)
var awaitters: seq[Future[void]]
for node in nodes:
awaitters.add(await node.start())
@ -138,7 +138,7 @@ suite "PubSub":
await allFutures(nodes.mapIt(it.stop()))
await allFutures(awaitters)
result = passed == 20
result = passed == 10
check:
waitFor(testBasicFloodSub()) == true

View File

@ -1,10 +1,10 @@
import unittest
import chronos
import ../libp2p/connection,
../libp2p/transports/transport,
../libp2p/transports/tcptransport,
../libp2p/multiaddress,
../libp2p/wire
import ../libp2p/[connection,
transports/transport,
transports/tcptransport,
multiaddress,
wire]
suite "TCP transport":
test "test listener: handle write":