summary refs log tree commit diff stats
path: root/tests/async/tasyncall.nim
diff options
context:
space:
mode:
authorKonstantin Molchanov <moigagoo@live.com>2016-06-03 15:19:39 +0300
committerKonstantin Molchanov <moigagoo@live.com>2016-06-03 15:19:39 +0300
commitd5d036ca9d449980bd0c71297444f4e2bd9f1e65 (patch)
tree6dc91e5a8af110cd72fc74f012c88a55419ff3b6 /tests/async/tasyncall.nim
parent3538e00fc7b317e4b4adb32ad5fdf2c72d35d481 (diff)
downloadNim-d5d036ca9d449980bd0c71297444f4e2bd9f1e65.tar.gz
Tests: tasyncall: Varargs test added.
Diffstat (limited to 'tests/async/tasyncall.nim')
-rw-r--r--tests/async/tasyncall.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/async/tasyncall.nim b/tests/async/tasyncall.nim
index 971122ad9..60ba557cc 100644
--- a/tests/async/tasyncall.nim
+++ b/tests/async/tasyncall.nim
@@ -32,6 +32,14 @@ proc testFuturesWithoutValues() =
 
   waitFor all(tasks)
 
+proc testVarargs(x, y, z: int): seq[int] =
+  let
+    a = futureWithValue(x)
+    b = futureWithValue(y)
+    c = futureWithValue(z)
+
+  result = waitFor all(a, b, c)
+
 block:
   let
     startTime = cpuTime()
@@ -48,3 +56,13 @@ block:
   let execTime = cpuTime() - startTime
 
   doAssert execTime * 1000 < taskCount * sleepDuration
+
+block:
+  let
+    startTime = cpuTime()
+    results = testVarargs(1, 2, 3)
+    expected = @[1, 2, 3]
+    execTime = cpuTime() - startTime
+
+  doAssert execTime * 100 < taskCount * sleepDuration
+  doAssert results == expected