summary refs log tree commit diff stats
path: root/tests/system/tmemory.nim
blob: 553037011d5bbe7b5a1c54eaa841c22c2322c17f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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