From 81c7be1b35da6a4f7a06b3f081a92b516ee34ee6 Mon Sep 17 00:00:00 2001 From: Konstantin Molchanov Date: Tue, 31 May 2016 23:49:59 +0400 Subject: [PATCH] Tests: async: Tests for `all` proc added. --- tests/async/tasyncall.nim | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/async/tasyncall.nim diff --git a/tests/async/tasyncall.nim b/tests/async/tasyncall.nim new file mode 100644 index 0000000000..971122ad90 --- /dev/null +++ b/tests/async/tasyncall.nim @@ -0,0 +1,50 @@ +discard """ + file: "tasyncall.nim" + exitcode: 0 +""" +import times, sequtils +import asyncdispatch + +const + taskCount = 10 + sleepDuration = 500 + +proc futureWithValue(x: int): Future[int] {.async.} = + await sleepAsync(sleepDuration) + return x + +proc futureWithoutValue() {.async.} = + await sleepAsync(1000) + +proc testFuturesWithValue(x: int): seq[int] = + var tasks = newSeq[Future[int]](taskCount) + + for i in 0..