diff options
author | Oscar NihlgÄrd <oscarnihlgard@gmail.com> | 2019-02-19 19:12:44 +0100 |
---|---|---|
committer | Miran <narimiran@disroot.org> | 2019-02-19 19:12:44 +0100 |
commit | 1a771a824810339e00c80691383c9220bcd9a13f (patch) | |
tree | a2447b72fe26aa490cd64d8b90e6d8f2c25c50d5 /tests/stdlib | |
parent | 50d1a46537d952bd3684bf752897f707456b0c3d (diff) | |
download | Nim-1a771a824810339e00c80691383c9220bcd9a13f.tar.gz |
Replace the duration conversion procs with new improved ones (#10710)
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/ttimes.nim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/stdlib/ttimes.nim b/tests/stdlib/ttimes.nim index 456ff6315..b29f5090b 100644 --- a/tests/stdlib/ttimes.nim +++ b/tests/stdlib/ttimes.nim @@ -588,3 +588,12 @@ suite "ttimes": let y = initDateTime(10, mMar, 1995, 00, 00, 00, utc()) doAssert x + between(x, y) == y doAssert between(x, y) == 1.months + 1.weeks + + test "inX procs": + doAssert initDuration(seconds = 1).inSeconds == 1 + doAssert initDuration(seconds = -1).inSeconds == -1 + doAssert initDuration(seconds = -1, nanoseconds = 1).inSeconds == 0 + doAssert initDuration(nanoseconds = -1).inSeconds == 0 + doAssert initDuration(milliseconds = 500).inMilliseconds == 500 + doAssert initDuration(milliseconds = -500).inMilliseconds == -500 + doAssert initDuration(nanoseconds = -999999999).inMilliseconds == -999 |