diff options
| author | Garrett D'Amore <garrett@damore.org> | 2016-12-23 00:41:43 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2016-12-23 00:41:43 -0800 |
| commit | 052e37eebb6b34c37997f46813689f8bbba92c18 (patch) | |
| tree | 5edf27eab39dbfc3275c49998986a4607a7f91f9 /tests | |
| parent | 236781a2c13feb96a6dd56f762b2df6fec1dfee5 (diff) | |
| download | nng-052e37eebb6b34c37997f46813689f8bbba92c18.tar.gz nng-052e37eebb6b34c37997f46813689f8bbba92c18.tar.bz2 nng-052e37eebb6b34c37997f46813689f8bbba92c18.zip | |
Initial tests -- open & close work (no pipes or endpoints yet).
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 |
