summary refs log tree commit diff stats
path: root/tests/system/tmemory.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/tmemory.nim')
-rw-r--r--tests/system/tmemory.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/system/tmemory.nim b/tests/system/tmemory.nim
new file mode 100644
index 000000000..553037011
--- /dev/null
+++ b/tests/system/tmemory.nim
@@ -0,0 +1,16 @@
+import std/assertions
+
+block: # cmpMem
+  type
+    SomeHash = array[15, byte]
+
+  var
+    a: SomeHash
+    b: SomeHash
+
+  a[^1] = byte(1)
+  let c = a
+
+  doAssert cmpMem(a.addr, b.addr, sizeof(SomeHash)) > 0
+  doAssert cmpMem(b.addr, a.addr, sizeof(SomeHash)) < 0
+  doAssert cmpMem(a.addr, c.addr, sizeof(SomeHash)) == 0