diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-06 08:18:50 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-06 08:21:09 -0800 |
| commit | a2801adffebb6a3679e41789b38ba925ed32832b (patch) | |
| tree | 8e3a743301fedb04d19d9af3e30f5622b737c337 /tests/trantest.h | |
| parent | 601d7a6ca95678613ca576258314f50a6e5e742c (diff) | |
| download | nng-a2801adffebb6a3679e41789b38ba925ed32832b.tar.gz nng-a2801adffebb6a3679e41789b38ba925ed32832b.tar.bz2 nng-a2801adffebb6a3679e41789b38ba925ed32832b.zip | |
Message API was awkward.
The use of a single function to get both size and length actually
turned out to be awkward to use; better to have separate functions
to get each. While here, disable some of the initialization/fork
checks, because it turns out they aren't needed.
Diffstat (limited to 'tests/trantest.h')
| -rw-r--r-- | tests/trantest.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/trantest.h b/tests/trantest.h index 9cd222fb..bd458d21 100644 --- a/tests/trantest.h +++ b/tests/trantest.h @@ -99,7 +99,6 @@ trantest_send_recv(trantest *tt) nng_endpoint *ep = NULL; nng_msg *send; nng_msg *recv; - char *body; size_t len; ep = NULL; @@ -118,9 +117,8 @@ trantest_send_recv(trantest *tt) recv = NULL; So(nng_recvmsg(tt->repsock, &recv, 0) == 0); So(recv != NULL); - So((body = nng_msg_body(recv, &len)) != NULL); - So(len == 5); - So(strcmp(body, "ping") == 0); + So(nng_msg_len(recv) == 5); + So(strcmp(nng_msg_body(recv), "ping") == 0); nng_msg_free(recv); len = strlen("acknowledge"); @@ -129,9 +127,8 @@ trantest_send_recv(trantest *tt) So(nng_sendmsg(tt->repsock, send, 0) == 0); So(nng_recvmsg(tt->reqsock, &recv, 0) == 0); So(recv != NULL); - So((body = nng_msg_body(recv, &len)) != NULL); - So(len == strlen("acknowledge")); - So(strcmp(body, "acknowledge") == 0); + So(nng_msg_len(recv) == strlen("acknowledge")); + So(strcmp(nng_msg_body(recv), "acknowledge") == 0); nng_msg_free(recv); }) } |
