diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-23 09:12:29 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-23 09:40:32 -0800 |
| commit | 3ed5d7e7c6bc995018ed9c3d63c18504f3983341 (patch) | |
| tree | ce7f482f04d8e56b4d77e1f58fec73d6606e5a64 /src/core/sock_test.c | |
| parent | 8f29c19954b7e4f0e47036b37b36ab9cd386ad70 (diff) | |
| download | nng-3ed5d7e7c6bc995018ed9c3d63c18504f3983341.tar.gz nng-3ed5d7e7c6bc995018ed9c3d63c18504f3983341.tar.bz2 nng-3ed5d7e7c6bc995018ed9c3d63c18504f3983341.zip | |
listener: add listener_create_url and listen_url
Diffstat (limited to 'src/core/sock_test.c')
| -rw-r--r-- | src/core/sock_test.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/sock_test.c b/src/core/sock_test.c index 0e8c6d29..4c1e2c7c 100644 --- a/src/core/sock_test.c +++ b/src/core/sock_test.c @@ -345,6 +345,48 @@ test_listener_options(void) } void +test_listener_create_url(void) +{ + nng_socket s1; + nng_listener l; + nng_url *u; + const nng_url *u2; + + NUTS_OPEN(s1); + NUTS_PASS(nng_url_parse(&u, "inproc://listener_opts2")); + + NUTS_PASS(nng_listener_create_url(&l, s1, u)); + nng_listener_get_url(l, &u2); + + NUTS_MATCH(nng_url_scheme(u), nng_url_scheme(u2)); + NUTS_MATCH(nng_url_path(u), nng_url_path(u2)); + nng_url_free(u); + + NUTS_CLOSE(s1); +} + +void +test_listen_url(void) +{ + nng_socket s1; + nng_listener l; + nng_url *u; + const nng_url *u2; + + NUTS_OPEN(s1); + NUTS_PASS(nng_url_parse(&u, "inproc://listen_url")); + + NUTS_PASS(nng_listen_url(s1, u, &l, 0)); + nng_listener_get_url(l, &u2); + + NUTS_MATCH(nng_url_scheme(u), nng_url_scheme(u2)); + NUTS_MATCH(nng_url_path(u), nng_url_path(u2)); + nng_url_free(u); + + NUTS_CLOSE(s1); +} + +void test_dialer_options(void) { nng_socket s1; @@ -470,6 +512,8 @@ NUTS_TESTS = { { "bad url", test_bad_url }, { "endpoint url", test_endpoint_url }, { "listener options", test_listener_options }, + { "listener create url", test_listener_create_url }, + { "listen url", test_listen_url }, { "dialer options", test_dialer_options }, { "timeout options", test_timeout_options }, { "size options", test_size_options }, |
