diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-23 09:17:24 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-23 09:40:32 -0800 |
| commit | 6dfdcac062fbae3046ab81326b57599d3645705f (patch) | |
| tree | 3472b93b5a5951e12a13067108fae99cf2ca2448 | |
| parent | 3ed5d7e7c6bc995018ed9c3d63c18504f3983341 (diff) | |
| download | nng-6dfdcac062fbae3046ab81326b57599d3645705f.tar.gz nng-6dfdcac062fbae3046ab81326b57599d3645705f.tar.bz2 nng-6dfdcac062fbae3046ab81326b57599d3645705f.zip | |
tests: add listener and dialer tests
| -rw-r--r-- | src/core/sock_test.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/sock_test.c b/src/core/sock_test.c index 4c1e2c7c..e311634d 100644 --- a/src/core/sock_test.c +++ b/src/core/sock_test.c @@ -412,6 +412,46 @@ test_dialer_options(void) } void +test_dialer_create_url(void) +{ + nng_socket s1; + nng_dialer d; + nng_url *u; + const nng_url *u2; + + NUTS_OPEN(s1); + + NUTS_PASS(nng_url_parse(&u, "inproc://dialer_create_url")); + NUTS_PASS(nng_dialer_create_url(&d, s1, u)); + NUTS_PASS(nng_dialer_get_url(d, &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_dial_url(void) +{ + nng_socket s1; + nng_dialer d; + nng_url *u; + const nng_url *u2; + + NUTS_OPEN(s1); + NUTS_PASS(nng_url_parse(&u, "inproc://dial_url")); + + NUTS_PASS(nng_dial_url(s1, u, &d, NNG_FLAG_NONBLOCK)); + nng_dialer_get_url(d, &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_endpoint_absent_options(void) { size_t s; @@ -515,6 +555,8 @@ NUTS_TESTS = { { "listener create url", test_listener_create_url }, { "listen url", test_listen_url }, { "dialer options", test_dialer_options }, + { "dialer create url", test_dialer_create_url }, + { "dial url", test_dial_url }, { "timeout options", test_timeout_options }, { "size options", test_size_options }, { "endpoint absent options", test_endpoint_absent_options }, |
