aboutsummaryrefslogtreecommitdiff
path: root/tests/sock.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-24 15:08:24 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-24 15:08:24 -0800
commitcb4fe7294f7da2ad1a2fdf896748b42e1a8115ab (patch)
tree1718afad8387d2dbcebb771d804fb7b5cf4d700b /tests/sock.c
parent9ff00f18a38559f668cb5c27e6d814dddffa801d (diff)
downloadnng-cb4fe7294f7da2ad1a2fdf896748b42e1a8115ab.tar.gz
nng-cb4fe7294f7da2ad1a2fdf896748b42e1a8115ab.tar.bz2
nng-cb4fe7294f7da2ad1a2fdf896748b42e1a8115ab.zip
Getopt implemented (and minimal test).
Diffstat (limited to 'tests/sock.c')
-rw-r--r--tests/sock.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/sock.c b/tests/sock.c
index 81361f8b..931e114a 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -53,5 +53,31 @@ TestMain("Socket Operations", {
So(rv == NNG_EAGAIN);
So(msg == NULL);
})
+
+ Convey("We can set and get options", {
+ int64_t when = 1234;
+ int64_t check = 0;
+ size_t sz;
+ rv = nng_setopt(sock, NNG_OPT_SNDTIMEO, &when,
+ sizeof (when));
+ So(rv == 0);
+ sz = sizeof (check);
+ Convey("Short size is not copied", {
+ sz = 0;
+ rv = nng_getopt(sock, NNG_OPT_SNDTIMEO,
+ &check, &sz);
+ So(rv == 0);
+ So(sz == sizeof (check));
+ So(check == 0);
+ })
+ Convey("Correct size is copied", {
+ sz = sizeof (check);
+ rv = nng_getopt(sock, NNG_OPT_SNDTIMEO, &check,
+ &sz);
+ So(rv == 0);
+ So(sz == sizeof (check));
+ So(check == 1234);
+ })
+ })
})
}) \ No newline at end of file