mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-02 13:03:11 +00:00
initial setup
This commit is contained in:
parent
61ff2594d3
commit
6ddcc5d4f8
1
tests/exCursor.nim
Normal file
1
tests/exCursor.nim
Normal file
@ -0,0 +1 @@
|
||||
|
||||
31
tests/exFailure.nim
Normal file
31
tests/exFailure.nim
Normal 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user