tnativesockets.nim 653 B

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