diff options
author | Rokas Kupstys <rokups@zoho.com> | 2017-02-20 17:03:39 +0200 |
---|---|---|
committer | Rokas Kupstys <rokups@zoho.com> | 2017-02-20 17:54:15 +0200 |
commit | 5aef77a3d3a0c2c8997fbb08163c0730a2742784 (patch) | |
tree | 38fe7b5793081a63ecebdef69e867567b0f979c9 /tests/coroutines/tgc.nim | |
parent | f80ddbbcc6a599f2a17275f2cca4d268f7f1fc63 (diff) | |
download | Nim-5aef77a3d3a0c2c8997fbb08163c0730a2742784.tar.gz |
Removed test code from coro.nim and created three real tests for coroutines
Diffstat (limited to 'tests/coroutines/tgc.nim')
-rw-r--r-- | tests/coroutines/tgc.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/coroutines/tgc.nim b/tests/coroutines/tgc.nim new file mode 100644 index 000000000..66a12ab9d --- /dev/null +++ b/tests/coroutines/tgc.nim @@ -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") |