summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/POSIX/htonl.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests/POSIX/htonl.c')
-rw-r--r--testsuites/libtests/POSIX/htonl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuites/libtests/POSIX/htonl.c b/testsuites/libtests/POSIX/htonl.c
new file mode 100644
index 0000000000..71aa969db7
--- /dev/null
+++ b/testsuites/libtests/POSIX/htonl.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 by
+ * Ralf Corsépius, Ulm, Germany. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <arpa/inet.h>
+
+int
+main (void)
+{
+ uint32_t u32;
+ uint16_t u16;
+
+ u32 = htonl(0x12345678);
+ u16 = htons(0x1234);
+
+ u32 = ntohl(0x12345678);
+ u16 = ntohs(0x1234);
+
+ return 0;
+}