aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-30 13:15:41 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-30 13:34:04 -0700
commit264ed002f15645193ad53d4ba51218365d979699 (patch)
treec4ed06d8ffd65bbdf9d94f994c96cecb17f56c81 /tests
parent2b0d31553e542c130e2595ff9a3ac9756a2c1619 (diff)
downloadnng-264ed002f15645193ad53d4ba51218365d979699.tar.gz
nng-264ed002f15645193ad53d4ba51218365d979699.tar.bz2
nng-264ed002f15645193ad53d4ba51218365d979699.zip
fixes #384 Add NN_PROTOCOL and related
Diffstat (limited to 'tests')
-rw-r--r--tests/reqrep.c30
1 files changed, 30 insertions, 0 deletions
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);