diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | tests/sock.c | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 46cae66a..8a2bbb5c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,3 +53,4 @@ else () endif () add_nng_test(list 5) +add_nng_test(sock 5)
\ No newline at end of file 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 |
