Skip to content

Commit

Permalink
ws: add some more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Nov 24, 2024
1 parent 569ef3e commit c79d87a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sp/transport/ws/ws_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//

#include "nng/nng.h"
#include <nuts.h>

static void
Expand Down Expand Up @@ -143,6 +144,7 @@ test_ws_recv_max(void)
nng_socket s0;
nng_socket s1;
nng_listener l;
nng_dialer d;
size_t sz;
char *addr;

Expand All @@ -156,10 +158,14 @@ test_ws_recv_max(void)
NUTS_PASS(nng_socket_get_size(s0, NNG_OPT_RECVMAXSZ, &sz));
NUTS_TRUE(sz == 200);
NUTS_PASS(nng_listener_set_size(l, NNG_OPT_RECVMAXSZ, 100));
NUTS_PASS(nng_listener_get_size(l, NNG_OPT_RECVMAXSZ, &sz));
NUTS_TRUE(sz == 100);
NUTS_PASS(nng_listener_start(l, 0));

NUTS_OPEN(s1);
NUTS_PASS(nng_dial(s1, addr, NULL, 0));
NUTS_PASS(nng_dial(s1, addr, &d, 0));
NUTS_PASS(nng_dialer_set_size(d, NNG_OPT_RECVMAXSZ, 256));
NUTS_PASS(nng_dialer_get_size(d, NNG_OPT_RECVMAXSZ, &sz));
NUTS_PASS(nng_send(s1, msg, 95, 0));
NUTS_PASS(nng_socket_set_ms(s1, NNG_OPT_SENDTIMEO, 100));
NUTS_PASS(nng_recv(s0, buf, &sz, 0));
Expand Down

0 comments on commit c79d87a

Please sign in to comment.