From f9f75254af258e33a9cb0b3d7ee300d49e4a1eb2 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 4 Oct 2019 09:26:41 -0600 Subject: [PATCH] readding commented out tests --- tests/testpubsub.nim | 68 ++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/testpubsub.nim b/tests/testpubsub.nim index 10c9d77f9..b8e2077b0 100644 --- a/tests/testpubsub.nim +++ b/tests/testpubsub.nim @@ -67,53 +67,53 @@ proc subscribeNodes*(nodes: seq[Switch]) {.async.} = await allFutures(pending) suite "PubSub": - # test "FloodSub basic publish/subscribe A -> B": - # proc testBasicPubSub(): Future[bool] {.async.} = - # var passed: bool - # proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} = - # check topic == "foobar" - # passed = true + test "FloodSub basic publish/subscribe A -> B": + proc testBasicPubSub(): Future[bool] {.async.} = + var passed: bool + proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} = + check topic == "foobar" + passed = true - # var nodes = generateNodes(2) - # var wait = await nodes[1].start() + var nodes = generateNodes(2) + var wait = await nodes[1].start() - # await nodes[0].subscribeToPeer(nodes[1].peerInfo) + await nodes[0].subscribeToPeer(nodes[1].peerInfo) - # await nodes[1].subscribe("foobar", handler) - # await sleepAsync(100.millis) + await nodes[1].subscribe("foobar", handler) + await sleepAsync(100.millis) - # await nodes[0].publish("foobar", cast[seq[byte]]("Hello!")) - # await sleepAsync(100.millis) + await nodes[0].publish("foobar", cast[seq[byte]]("Hello!")) + await sleepAsync(100.millis) - # await nodes[1].stop() - # await allFutures(wait) - # result = passed + await nodes[1].stop() + await allFutures(wait) + result = passed - # check: - # waitFor(testBasicPubSub()) == true + check: + waitFor(testBasicPubSub()) == true - # test "FloodSub basic publish/subscribe B -> A": - # proc testBasicPubSub(): Future[bool] {.async.} = - # proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} = - # check topic == "foobar" + test "FloodSub basic publish/subscribe B -> A": + proc testBasicPubSub(): Future[bool] {.async.} = + proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} = + check topic == "foobar" - # var nodes = generateNodes(2) - # var wait = await nodes[1].start() + var nodes = generateNodes(2) + var wait = await nodes[1].start() - # await nodes[0].subscribeToPeer(nodes[1].peerInfo) + await nodes[0].subscribeToPeer(nodes[1].peerInfo) - # await nodes[0].subscribe("foobar", handler) - # await sleepAsync(10.millis) + await nodes[0].subscribe("foobar", handler) + await sleepAsync(10.millis) - # await nodes[1].publish("foobar", cast[seq[byte]]("Hello!")) - # await sleepAsync(10.millis) + await nodes[1].publish("foobar", cast[seq[byte]]("Hello!")) + await sleepAsync(10.millis) - # await nodes[1].stop() - # await allFutures(wait) - # result = true + await nodes[1].stop() + await allFutures(wait) + result = true - # check: - # waitFor(testBasicPubSub()) == true + check: + waitFor(testBasicPubSub()) == true test "FloodSub multiple peers, no self trigger": proc testBasicFloodSub(): Future[bool] {.async.} =