aboutsummaryrefslogtreecommitdiff
path: root/tests/reqrep.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-20 01:19:06 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-20 01:19:06 -0800
commitcb7e65fd5004fd24a7c23137e849c2828d2de6c3 (patch)
tree3de27fee15b13faf6ef649ea9760f173555b1bdc /tests/reqrep.c
parenta26375dc1ec12c41aaedf3e374175d37a1ae84e9 (diff)
downloadnng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.tar.gz
nng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.tar.bz2
nng-cb7e65fd5004fd24a7c23137e849c2828d2de6c3.zip
fixes #18 Sockets should be uint32_t's (handles) not pointers.
Diffstat (limited to 'tests/reqrep.c')
-rw-r--r--tests/reqrep.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/tests/reqrep.c b/tests/reqrep.c
index 9fd2a206..52269711 100644
--- a/tests/reqrep.c
+++ b/tests/reqrep.c
@@ -20,11 +20,9 @@ Main({
Test("REQ/REP pattern", {
Convey("We can create a REQ socket", {
- nng_socket *req;
+ nng_socket req;
- rv = nng_open(&req, NNG_PROTO_REQ);
- So(rv == 0);
- So(req != NULL);
+ So(nng_open(&req, NNG_PROTO_REQ) == 0);
Reset({
nng_close(req);
@@ -43,10 +41,8 @@ Main({
})
Convey("We can create a REP socket", {
- nng_socket *rep;
- rv = nng_open(&rep, NNG_PROTO_REP);
- So(rv == 0);
- So(rep != NULL);
+ nng_socket rep;
+ So(nng_open(&rep, NNG_PROTO_REP) == 0);
Reset({
nng_close(rep);
@@ -68,27 +64,20 @@ Main({
})
Convey("We can create a linked REQ/REP pair", {
- nng_socket *req;
- nng_socket *rep;
+ nng_socket req;
+ nng_socket rep;
- rv = nng_open(&rep, NNG_PROTO_REP);
- So(rv == 0);
- So(rep != NULL);
+ So(nng_open(&rep, NNG_PROTO_REP) == 0);
- rv = nng_open(&req, NNG_PROTO_REQ);
- So(rv == 0);
- So(req != NULL);
+ So(nng_open(&req, NNG_PROTO_REQ) == 0);
Reset({
nng_close(rep);
nng_close(req);
})
- rv = nng_listen(rep, addr, NULL, NNG_FLAG_SYNCH);
- So(rv == 0);
-
- rv = nng_dial(req, addr, NULL, NNG_FLAG_SYNCH);
- So(rv == 0);
+ So(nng_listen(rep, addr, NULL, NNG_FLAG_SYNCH) == 0);
+ So(nng_dial(req, addr, NULL, NNG_FLAG_SYNCH) == 0);
Convey("They can REQ/REP exchange", {
nng_msg *ping;
@@ -123,14 +112,12 @@ Main({
uint64_t retry = 100000; // 100 ms
size_t len;
- nng_socket *req;
- nng_socket *rep;
+ nng_socket req;
+ nng_socket rep;
So(nng_open(&rep, NNG_PROTO_REP) == 0);
- So(rep != NULL);
So(nng_open(&req, NNG_PROTO_REQ) == 0);
- So(req != NULL);
Reset({
nng_close(rep);