From 264ed002f15645193ad53d4ba51218365d979699 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 30 Apr 2018 13:15:41 -0700 Subject: fixes #384 Add NN_PROTOCOL and related --- tests/reqrep.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/reqrep.c') diff --git a/tests/reqrep.c b/tests/reqrep.c index 76cf279c..b5a32dcf 100644 --- a/tests/reqrep.c +++ b/tests/reqrep.c @@ -27,6 +27,21 @@ TestMain("REQ/REP pattern", { Reset({ nng_close(req); }); + Convey("Protocol & peer options match", { + int p; + char *s; + So(nng_getopt_int(req, NNG_OPT_PROTO, &p) == 0); + So(p == 48); + So(nng_getopt_string(req, NNG_OPT_PROTONAME, &s) == 0); + So(strcmp(s, "req") == 0); + nng_strfree(s); + So(nng_getopt_int(req, NNG_OPT_PEER, &p) == 0); + So(p == 49); + So(nng_getopt_string(req, NNG_OPT_PEERNAME, &s) == 0); + So(strcmp(s, "rep") == 0); + nng_strfree(s); + }); + Convey("Resend time option id works", { // Set timeout. @@ -50,6 +65,21 @@ TestMain("REQ/REP pattern", { Reset({ nng_close(rep); }); + Convey("Protocol & peer options match", { + int p; + char *s; + So(nng_getopt_int(rep, NNG_OPT_PROTO, &p) == 0); + So(p == 49); + So(nng_getopt_string(rep, NNG_OPT_PROTONAME, &s) == 0); + So(strcmp(s, "rep") == 0); + nng_strfree(s); + So(nng_getopt_int(rep, NNG_OPT_PEER, &p) == 0); + So(p == 48); + So(nng_getopt_string(rep, NNG_OPT_PEERNAME, &s) == 0); + So(strcmp(s, "req") == 0); + nng_strfree(s); + }); + Convey("Send with no recv fails", { nng_msg *msg; rv = nng_msg_alloc(&msg, 0); -- cgit v1.2.3-70-g09d2