tnativesockets.nim 604 B

123456789101112131415161718192021222324252627
  1. import std/nativesockets
  2. import stdtest/testutils
  3. import std/assertions
  4. block:
  5. let hostname = getHostname()
  6. doAssert hostname.len > 0
  7. when defined(windows):
  8. assertAll:
  9. toInt(IPPROTO_IP) == 0
  10. toInt(IPPROTO_ICMP) == 1
  11. toInt(IPPROTO_TCP) == 6
  12. toInt(IPPROTO_UDP) == 17
  13. toInt(IPPROTO_IPV6) == 41
  14. toInt(IPPROTO_ICMPV6) == 58
  15. toInt(IPPROTO_RAW) == 20
  16. # no changes to enum value
  17. ord(IPPROTO_TCP) == 6
  18. ord(IPPROTO_UDP) == 17
  19. ord(IPPROTO_IP) == 18
  20. ord(IPPROTO_IPV6) == 19
  21. ord(IPPROTO_RAW) == 20
  22. ord(IPPROTO_ICMP) == 21
  23. ord(IPPROTO_ICMPV6) == 22