summary refs log tree commit diff stats
path: root/tests/stdlib/tnativesockets.nim
blob: b0cfd09cfaee366a1e735b7f8774d95dc84af873 (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
discard """
  cmd:      "nim c -r --styleCheck:hint --panics:on $options $file"
  targets:  "c"
  nimout:   ""
  action:   "run"
  exitcode: 0
  timeout:  60.0
"""

import nativesockets


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

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