diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bus.c | 23 | ||||
| -rw-r--r-- | tests/event.c | 4 | ||||
| -rw-r--r-- | tests/pipeline.c | 18 | ||||
| -rw-r--r-- | tests/pubsub.c | 8 | ||||
| -rw-r--r-- | tests/reqrep.c | 37 | ||||
| -rw-r--r-- | tests/sock.c | 4 | ||||
| -rw-r--r-- | tests/survey.c | 10 | ||||
| -rw-r--r-- | tests/tcp.c | 6 | ||||
| -rw-r--r-- | tests/trantest.h | 4 |
9 files changed, 47 insertions, 67 deletions
diff --git a/tests/bus.c b/tests/bus.c index bb8531bd..6703fa0e 100644 --- a/tests/bus.c +++ b/tests/bus.c @@ -18,16 +18,14 @@ So(memcmp(nng_msg_body(m), s, strlen(s)) == 0) Main({ - int rv; const char *addr = "inproc://test"; nni_init(); Test("BUS pattern", { Convey("We can create a BUS socket", { - nng_socket *bus; + nng_socket bus; So(nng_open(&bus, NNG_PROTO_BUS) == 0); - So(bus != NULL); Reset({ nng_close(bus); @@ -40,20 +38,15 @@ Main({ }) Convey("We can create a linked BUS topology", { - nng_socket *bus1; - nng_socket *bus2; - nng_socket *bus3; + nng_socket bus1; + nng_socket bus2; + nng_socket bus3; uint64_t rtimeo; - So((rv = nng_open(&bus1, NNG_PROTO_BUS)) == 0); - So(bus1 != NULL); - - So((rv = nng_open(&bus2, NNG_PROTO_BUS)) == 0); - So(bus2 != NULL); - - So((rv = nng_open(&bus3, NNG_PROTO_BUS)) == 0); - So(bus3 != NULL); - + So(nng_open(&bus1, NNG_PROTO_BUS) == 0); + So(nng_open(&bus2, NNG_PROTO_BUS) == 0); + So(nng_open(&bus3, NNG_PROTO_BUS) == 0); + Reset({ nng_close(bus1); nng_close(bus2); diff --git a/tests/event.c b/tests/event.c index ab42203b..f6e0ab3a 100644 --- a/tests/event.c +++ b/tests/event.c @@ -73,8 +73,8 @@ Main({ Test("Event Handling", { Convey("Given a connected pair of pair sockets", { - nng_socket *sock1; - nng_socket *sock2; + nng_socket sock1; + nng_socket sock2; struct evcnt evcnt1; struct evcnt evcnt2; nng_notify *notify1; diff --git a/tests/pipeline.c b/tests/pipeline.c index 5339146f..688c48bf 100644 --- a/tests/pipeline.c +++ b/tests/pipeline.c @@ -23,7 +23,7 @@ Main({ Test("PIPELINE (PUSH/PULL) pattern", { Convey("We can create a PUSH socket", { - nng_socket *push; + nng_socket push; So(nng_open(&push, NNG_PROTO_PUSH) == 0); So(push != NULL); @@ -44,7 +44,7 @@ Main({ }) Convey("We can create a PULL socket", { - nng_socket *pull; + nng_socket pull; So(nng_open(&pull, NNG_PROTO_PULL) == 0); So(pull != NULL); @@ -66,9 +66,9 @@ Main({ }) Convey("We can create a linked PUSH/PULL pair", { - nng_socket *push = NULL; - nng_socket *pull = NULL; - nng_socket *what = NULL; + nng_socket push = NULL; + nng_socket pull = NULL; + nng_socket what = NULL; So(nng_open(&push, NNG_PROTO_PUSH) == 0); So(nng_open(&pull, NNG_PROTO_PULL) == 0); @@ -107,10 +107,10 @@ Main({ nng_msg *def; uint64_t usecs; int len; - nng_socket *push; - nng_socket *pull1; - nng_socket *pull2; - nng_socket *pull3; + nng_socket push; + nng_socket pull1; + nng_socket pull2; + nng_socket pull3; So(nng_open(&push, NNG_PROTO_PUSH) == 0); So(nng_open(&pull1, NNG_PROTO_PULL) == 0); diff --git a/tests/pubsub.c b/tests/pubsub.c index 39e8fe12..12355554 100644 --- a/tests/pubsub.c +++ b/tests/pubsub.c @@ -24,7 +24,7 @@ Main({ Test("PUB/SUB pattern", { Convey("We can create a PUB socket", { - nng_socket *pub; + nng_socket pub; So(nng_open(&pub, NNG_PROTO_PUB) == 0); So(pub != NULL); @@ -45,7 +45,7 @@ Main({ }) Convey("We can create a SUB socket", { - nng_socket *sub; + nng_socket sub; So(nng_open(&sub, NNG_PROTO_SUB) == 0); So(sub != NULL); @@ -67,8 +67,8 @@ Main({ }) Convey("We can create a linked PUB/SUB pair", { - nng_socket *pub; - nng_socket *sub; + nng_socket pub; + nng_socket sub; So((rv = nng_open(&pub, NNG_PROTO_PUB)) == 0); So(pub != NULL); 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); diff --git a/tests/sock.c b/tests/sock.c index 123354ac..9ceb99cb 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -20,7 +20,7 @@ Main({ Convey("We are able to open a PAIR socket", { int rv; - nng_socket *sock = NULL; + nng_socket sock = NULL; rv = nng_open(&sock, NNG_PROTO_PAIR); So(rv == 0); @@ -147,7 +147,7 @@ Main({ }) Convey("We can send and receive messages", { - nng_socket *sock2 = NULL; + nng_socket sock2 = NULL; int len = 1; nng_msg *msg; uint64_t second = 1000000; diff --git a/tests/survey.c b/tests/survey.c index a749b0b1..9ce7f20b 100644 --- a/tests/survey.c +++ b/tests/survey.c @@ -24,7 +24,7 @@ Main({ Test("SURVEY pattern", { Convey("We can create a SURVEYOR socket", { - nng_socket *surv; + nng_socket surv; So(nng_open(&surv, NNG_PROTO_SURVEYOR) == 0); So(surv != NULL); @@ -55,7 +55,7 @@ Main({ }) Convey("We can create a RESPONDENT socket", { - nng_socket *resp; + nng_socket resp; So(nng_open(&resp, NNG_PROTO_RESPONDENT) == 0); So(resp != NULL); @@ -77,9 +77,9 @@ Main({ }) Convey("We can create a linked survey pair", { - nng_socket *surv; - nng_socket *resp; - nng_socket *sock; + nng_socket surv; + nng_socket resp; + nng_socket sock; uint64_t expire; So(nng_open(&surv, NNG_PROTO_SURVEYOR) == 0); diff --git a/tests/tcp.c b/tests/tcp.c index 4cc9070e..0ec69121 100644 --- a/tests/tcp.c +++ b/tests/tcp.c @@ -21,7 +21,7 @@ TestMain("TCP Transport", { Convey("We cannot connect to wild cards", { - nng_socket *s; + nng_socket s; So(nng_open(&s, NNG_PROTO_PAIR) == 0); Reset({ @@ -31,8 +31,8 @@ TestMain("TCP Transport", { }) Convey("We can bind to wild card", { - nng_socket *s1; - nng_socket *s2; + nng_socket s1; + nng_socket s2; So(nng_open(&s1, NNG_PROTO_PAIR) == 0); So(nng_open(&s2, NNG_PROTO_PAIR) == 0); Reset({ diff --git a/tests/trantest.h b/tests/trantest.h index 23081c35..fab3371d 100644 --- a/tests/trantest.h +++ b/tests/trantest.h @@ -19,8 +19,8 @@ typedef struct { char addr[NNG_MAXADDRLEN+1]; - nng_socket *reqsock; - nng_socket *repsock; + nng_socket reqsock; + nng_socket repsock; nni_tran *tran; } trantest; |
