summary refs log tree commit diff stats
path: root/tests/stdlib/tmonotimes.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/tmonotimes.nim')
-rw-r--r--tests/stdlib/tmonotimes.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/stdlib/tmonotimes.nim b/tests/stdlib/tmonotimes.nim
new file mode 100644
index 000000000..1366dbfe9
--- /dev/null
+++ b/tests/stdlib/tmonotimes.nim
@@ -0,0 +1,22 @@
+discard """
+  matrix: "--mm:refc; --mm:orc"
+  targets: "c js"
+"""
+
+import std/[monotimes, times]
+import std/assertions
+
+let d = initDuration(nanoseconds = 10)
+let t1 = getMonoTime()
+let t2 = t1 + d
+
+doAssert t2 - t1 == d
+doAssert t1 == t1
+doAssert t1 != t2
+doAssert t2 - d == t1
+doAssert t1 < t2
+doAssert t1 <= t2
+doAssert t1 <= t1
+doAssert not(t2 < t1)
+doAssert t1 < high(MonoTime)
+doAssert low(MonoTime) < t1