summary refs log tree commit diff stats
path: root/tests/stdlib/tnativesockets.nim
blob: 8242beb836c94f56136203e813ab7c3c05b09f6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
discard """
  matrix: "--mm:refc; --mm:orc"
"""

import std/nativesockets
import stdtest/testutils
import std/assertions

block:
  let hostname = getHostname()
  doAssert hostname.len > 0

when defined(windows):
  assertAll:
    toInt(IPPROTO_IP) == 0
    toInt(IPPROTO_ICMP) == 1
    toInt(IPPROTO_TCP) == 6
    toInt(IPPROTO_UDP) == 17
    toInt(IPPROTO_IPV6) == 41
    toInt(IPPROTO_ICMPV6) == 58
    toInt(IPPROTO_RAW) == 20

    # no changes to enum value
    ord(IPPROTO_TCP) == 6
    ord(IPPROTO_UDP) == 17
    ord(IPPROTO_IP) == 18
    ord(IPPROTO_IPV6) == 19
    ord(IPPROTO_RAW) == 20
    ord(IPPROTO_ICMP) == 21
    ord(IPPROTO_ICMPV6) == 22