Removed test code from coro.nim and created three real tests for coroutines
This commit is contained in:
parent
f80ddbbcc6
commit
5aef77a3d3
8 changed files with 71 additions and 92 deletions
15
tests/coroutines/tgc.nim
Normal file
15
tests/coroutines/tgc.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import coro
|
||||
|
||||
var maxOccupiedMemory = 0
|
||||
|
||||
proc testGC() =
|
||||
var numbers = newSeq[int](100)
|
||||
maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
|
||||
suspend(0)
|
||||
|
||||
start(testGC)
|
||||
start(testGC)
|
||||
run()
|
||||
|
||||
GC_fullCollect()
|
||||
doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")
|
||||
Loading…
Add table
Add a link
Reference in a new issue