nim-codex/tests/codex/testclock.nim
Dmitriy Ryajov bd594c9aaf
Create memory-leak detecting test suite (#226)
* adding tracker for streamstore

* adding tracker tests

* Sets up tracker helper functions and closes streams in testnode.nim

* Deploying checksuite for memory leak tracker checking.

* Successfully deploys checksuite and asyncchecksuite.

* Fix leak in testpor.nim

* Fixes leaked storestream in testnetwork.nim

* Fixes integration tests

* Cleanup

* cleanup comment by Mark

---------

Co-authored-by: benbierens <thatbenbierens@gmail.com>
2023-06-22 12:01:21 -06:00

27 lines
501 B
Nim

import std/unittest
import codex/clock
import ./helpers
checksuite "Clock":
proc testConversion(seconds: SecondsSince1970) =
let asBytes = seconds.toBytes
let restored = asBytes.toSecondsSince1970
check restored == seconds
test "SecondsSince1970 should support bytes conversions":
let secondsToTest: seq[int64] = @[
int64.high,
int64.low,
0,
1,
12345,
-1,
-12345
]
for seconds in secondsToTest:
testConversion(seconds)