From cb4fe7294f7da2ad1a2fdf896748b42e1a8115ab Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 24 Dec 2016 15:08:24 -0800 Subject: Getopt implemented (and minimal test). --- tests/sock.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/sock.c') 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 -- cgit v1.2.3-70-g09d2