aboutsummaryrefslogtreecommitdiff
path: root/tests/sock.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-23 00:41:43 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-23 00:41:43 -0800
commit052e37eebb6b34c37997f46813689f8bbba92c18 (patch)
tree5edf27eab39dbfc3275c49998986a4607a7f91f9 /tests/sock.c
parent236781a2c13feb96a6dd56f762b2df6fec1dfee5 (diff)
downloadnng-052e37eebb6b34c37997f46813689f8bbba92c18.tar.gz
nng-052e37eebb6b34c37997f46813689f8bbba92c18.tar.bz2
nng-052e37eebb6b34c37997f46813689f8bbba92c18.zip
Initial tests -- open & close work (no pipes or endpoints yet).
Diffstat (limited to 'tests/sock.c')
-rw-r--r--tests/sock.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/sock.c b/tests/sock.c
new file mode 100644
index 00000000..40949bfe
--- /dev/null
+++ b/tests/sock.c
@@ -0,0 +1,31 @@
+//
+// Copyright 2016 Garrett D'Amore <garrett@damore.org>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#include "convey.h"
+#include "nng.h"
+
+TestMain("Socket Operations", {
+ Convey("We are able to open a PAIR socket", {
+ int rv;
+ nng_socket *sock = NULL;
+
+ rv = nng_socket_create(&sock, NNG_PROTO_PAIR);
+ So(rv == 0);
+ So(sock != NULL);
+
+ Convey("And we can close it", {
+ rv = nng_socket_close(sock);
+ So(rv == 0);
+ })
+
+ Convey("It's type is still proto", {
+ So(nng_socket_protocol(sock) == NNG_PROTO_PAIR);
+ })
+ })
+}) \ No newline at end of file