diff options
Diffstat (limited to 'test/core/support/host_port_test.c')
-rw-r--r-- | test/core/support/host_port_test.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.c index 71a774191b..eccc39a2db 100644 --- a/test/core/support/host_port_test.c +++ b/test/core/support/host_port_test.c @@ -38,43 +38,36 @@ #include <grpc/support/log.h> #include "test/core/util/test_config.h" -static void -join_host_port_expect (const char *host, int port, const char *expected) -{ +static void join_host_port_expect(const char *host, int port, + const char *expected) { char *buf; int len; - len = gpr_join_host_port (&buf, host, port); - GPR_ASSERT (len >= 0); - GPR_ASSERT (strlen (expected) == (size_t) len); - GPR_ASSERT (strcmp (expected, buf) == 0); - gpr_free (buf); + len = gpr_join_host_port(&buf, host, port); + GPR_ASSERT(len >= 0); + GPR_ASSERT(strlen(expected) == (size_t)len); + GPR_ASSERT(strcmp(expected, buf) == 0); + gpr_free(buf); } -static void -test_join_host_port (void) -{ - join_host_port_expect ("foo", 101, "foo:101"); - join_host_port_expect ("", 102, ":102"); - join_host_port_expect ("1::2", 103, "[1::2]:103"); - join_host_port_expect ("[::1]", 104, "[::1]:104"); +static void test_join_host_port(void) { + join_host_port_expect("foo", 101, "foo:101"); + join_host_port_expect("", 102, ":102"); + join_host_port_expect("1::2", 103, "[1::2]:103"); + join_host_port_expect("[::1]", 104, "[::1]:104"); } /* Garbage in, garbage out. */ -static void -test_join_host_port_garbage (void) -{ - join_host_port_expect ("[foo]", 105, "[foo]:105"); - join_host_port_expect ("[::", 106, "[:::106"); - join_host_port_expect ("::]", 107, "[::]]:107"); +static void test_join_host_port_garbage(void) { + join_host_port_expect("[foo]", 105, "[foo]:105"); + join_host_port_expect("[::", 106, "[:::106"); + join_host_port_expect("::]", 107, "[::]]:107"); } -int -main (int argc, char **argv) -{ - grpc_test_init (argc, argv); +int main(int argc, char **argv) { + grpc_test_init(argc, argv); - test_join_host_port (); - test_join_host_port_garbage (); + test_join_host_port(); + test_join_host_port_garbage(); return 0; } |