aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-02-04 19:44:26 -0600
committerDavid Barksdale <amatus@amatus.name>2014-02-06 22:03:05 -0600
commit2ca930a92e3199b0112661204cbc14c3709da2e3 (patch)
treeffab7ec28698c99faa759daa8e34069c6a668f37
parent80ff55e488df6b0e7762e923efa7ee1d869e3dc1 (diff)
Test in6addr_* constants
-rw-r--r--tests/netinet/in.cpp14
-rw-r--r--tests/netinet/in.out1
-rw-r--r--tests/test_core.py5
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/netinet/in.cpp b/tests/netinet/in.cpp
new file mode 100644
index 00000000..eaadfba2
--- /dev/null
+++ b/tests/netinet/in.cpp
@@ -0,0 +1,14 @@
+#include <netinet/in.h>
+extern "C" int puts(const char *);
+int main() {
+ struct in6_addr in6any = IN6ADDR_ANY_INIT;
+ struct in6_addr in6loopback = IN6ADDR_LOOPBACK_INIT;
+ int i;
+ for (i = 0; i < 16; ++i)
+ if (in6any.s6_addr[i] != in6addr_any.s6_addr[i])
+ return puts("in6addr_any != IN6ADDR_ANY_INIT\n");
+ for (i = 0; i < 16; ++i)
+ if (in6loopback.s6_addr[i] != in6addr_loopback.s6_addr[i])
+ return puts("in6addr_loopback != IN6ADDR_LOOPBACK_INIT\n");
+ return puts("pass");
+}
diff --git a/tests/netinet/in.out b/tests/netinet/in.out
new file mode 100644
index 00000000..2ae28399
--- /dev/null
+++ b/tests/netinet/in.out
@@ -0,0 +1 @@
+pass
diff --git a/tests/test_core.py b/tests/test_core.py
index a77d2465..7c3c8857 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4376,6 +4376,11 @@ PORT: 3979
self.do_run_from_file(src, output)
+ def test_netinet_in(self):
+ src = open(path_from_root('tests', 'netinet', 'in.cpp'), 'r').read()
+ expected = open(path_from_root('tests', 'netinet', 'in.out'), 'r').read()
+ self.do_run(src, expected)
+
# libc++ tests
def test_iostream(self):