summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-09-07 18:10:20 +0800
committerGitHub <noreply@github.com>2020-09-07 12:10:20 +0200
commite08b802d79e173d230b893ed96fd82c3c5228161 (patch)
treeab2a1ebec22add38e01e070e015300f8d15fe82a /tests
parent2f6d04fd5d302646d40abc60b611653ec58463d0 (diff)
downloadNim-e08b802d79e173d230b893ed96fd82c3c5228161.tar.gz
more Protocol supports in windows (#15274) [backport:1.2]
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tnativesockets.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/stdlib/tnativesockets.nim b/tests/stdlib/tnativesockets.nim
new file mode 100644
index 000000000..b0cfd09cf
--- /dev/null
+++ b/tests/stdlib/tnativesockets.nim
@@ -0,0 +1,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