mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-03 05:23:09 +00:00
adds string support
This commit is contained in:
parent
9f13d4bc35
commit
2f6faf0c77
@ -18,6 +18,11 @@ proc addNumValues(vals: openArray[float]): float {.asyncTask.} =
|
||||
for x in vals:
|
||||
result += x
|
||||
|
||||
proc strCompute(val: openArray[char]): int {.asyncTask.} =
|
||||
## note includes null terminator!
|
||||
return val.len()
|
||||
|
||||
|
||||
suite "async tests":
|
||||
var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads.
|
||||
var jobsVar = newJobQueue[float](taskpool = tp)
|
||||
@ -37,6 +42,11 @@ suite "async tests":
|
||||
let res = await jobs.submit(addNumValues(args))
|
||||
check res == 6.0
|
||||
|
||||
asyncTest "test strCompute":
|
||||
var jobs = newJobQueue[int](taskpool = tp)
|
||||
let res = await jobs.submit(strCompute("hello world!"))
|
||||
check res == 13 # note includes cstring null terminator
|
||||
|
||||
asyncTest "testing openArrays":
|
||||
var jobs = newJobQueue[float](taskpool = tp)
|
||||
let fut1 = jobs.submit(addNumValues(@[1.0.float, 2.0]))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user