initial setup

This commit is contained in:
Jaremy Creechley 2024-02-21 19:51:43 -07:00
parent 61ff2594d3
commit 6ddcc5d4f8
2 changed files with 32 additions and 0 deletions

1
tests/exCursor.nim Normal file
View File

@ -0,0 +1 @@

31
tests/exFailure.nim Normal file
View File

@ -0,0 +1,31 @@
import std/os
import std/sequtils
import chronos
import chronos/threadsync
import chronos/unittest2/asynctests
import taskpools
import apatheia/queues
proc worker(data: seq[char], queue: SignalQueue[int]) =
os.sleep(50)
echo "worker: ", data
discard queue.send(data.len())
suite "async tests":
var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads.
var queue = newSignalQueue[int]()
asyncTest "test":
## init
var data = "hello world!".toSeq
tp.spawn worker(data, queue)
let res = await wait(queue).wait(1500.milliseconds)
check res.get() == 12