diff options
author | Antonis Geralis <43617260+planetis-m@users.noreply.github.com> | 2020-12-29 14:27:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 13:27:08 +0100 |
commit | d5a3c2c2da2e3b2f6deeb2c1cd5430db90bc4fd5 (patch) | |
tree | d804dd9244a8e8362e50ccc3aa0b04f3cc3b2770 /tests/stdlib/tmemory.nim | |
parent | fc1a4faf568424b221e6690257ee96c66e68408e (diff) | |
download | Nim-d5a3c2c2da2e3b2f6deeb2c1cd5430db90bc4fd5.tar.gz |
Added cmpMem export (#16484)
* added cmpMem export * updates * fix test * Tiny changelog change * Add a dot. Co-authored-by: Clyybber <darkmine956@gmail.com>
Diffstat (limited to 'tests/stdlib/tmemory.nim')
-rw-r--r-- | tests/stdlib/tmemory.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/stdlib/tmemory.nim b/tests/stdlib/tmemory.nim new file mode 100644 index 000000000..25b5d526a --- /dev/null +++ b/tests/stdlib/tmemory.nim @@ -0,0 +1,15 @@ + +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.unsafeAddr, sizeof(SomeHash)) == 0 |