diff options
author | 2015-09-22 12:33:20 -0700 | |
---|---|---|
committer | 2015-09-22 12:33:20 -0700 | |
commit | a82950e68318a6aab6fe894fa39f7fa616c4647b (patch) | |
tree | 7d02bd1e9e1cbae1f14ad4ad1e06d3ae81a96dfe /test/core/iomgr/resolve_address_test.c | |
parent | 8af4c337181322cc4fb396199c90f574cfb4163f (diff) |
clang-format all core files
Diffstat (limited to 'test/core/iomgr/resolve_address_test.c')
-rw-r--r-- | test/core/iomgr/resolve_address_test.c | 149 |
1 files changed, 63 insertions, 86 deletions
diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 814cb9e150..1c95a9960e 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -38,124 +38,101 @@ #include <grpc/support/time.h> #include "test/core/util/test_config.h" -static gpr_timespec -test_deadline (void) -{ - return GRPC_TIMEOUT_SECONDS_TO_DEADLINE (100); +static gpr_timespec test_deadline(void) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100); } -static void -must_succeed (grpc_exec_ctx * exec_ctx, void *evp, grpc_resolved_addresses * p) -{ - GPR_ASSERT (p); - GPR_ASSERT (p->naddrs >= 1); - grpc_resolved_addresses_destroy (p); - gpr_event_set (evp, (void *) 1); +static void must_succeed(grpc_exec_ctx *exec_ctx, void *evp, + grpc_resolved_addresses *p) { + GPR_ASSERT(p); + GPR_ASSERT(p->naddrs >= 1); + grpc_resolved_addresses_destroy(p); + gpr_event_set(evp, (void *)1); } -static void -must_fail (grpc_exec_ctx * exec_ctx, void *evp, grpc_resolved_addresses * p) -{ - GPR_ASSERT (!p); - gpr_event_set (evp, (void *) 1); +static void must_fail(grpc_exec_ctx *exec_ctx, void *evp, + grpc_resolved_addresses *p) { + GPR_ASSERT(!p); + gpr_event_set(evp, (void *)1); } -static void -test_localhost (void) -{ +static void test_localhost(void) { gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address ("localhost:1", NULL, must_succeed, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); + gpr_event_init(&ev); + grpc_resolve_address("localhost:1", NULL, must_succeed, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); } -static void -test_default_port (void) -{ +static void test_default_port(void) { gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address ("localhost", "1", must_succeed, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); + gpr_event_init(&ev); + grpc_resolve_address("localhost", "1", must_succeed, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); } -static void -test_missing_default_port (void) -{ +static void test_missing_default_port(void) { gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address ("localhost", NULL, must_fail, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); + gpr_event_init(&ev); + grpc_resolve_address("localhost", NULL, must_fail, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); } -static void -test_ipv6_with_port (void) -{ +static void test_ipv6_with_port(void) { gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address ("[2001:db8::1]:1", NULL, must_succeed, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); + gpr_event_init(&ev); + grpc_resolve_address("[2001:db8::1]:1", NULL, must_succeed, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); } -static void -test_ipv6_without_port (void) -{ +static void test_ipv6_without_port(void) { const char *const kCases[] = { - "2001:db8::1", "2001:db8::1.2.3.4", "[2001:db8::1]", + "2001:db8::1", "2001:db8::1.2.3.4", "[2001:db8::1]", }; unsigned i; - for (i = 0; i < sizeof (kCases) / sizeof (*kCases); i++) - { - gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address (kCases[i], "80", must_succeed, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); - } + for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { + gpr_event ev; + gpr_event_init(&ev); + grpc_resolve_address(kCases[i], "80", must_succeed, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); + } } -static void -test_invalid_ip_addresses (void) -{ +static void test_invalid_ip_addresses(void) { const char *const kCases[] = { - "293.283.1238.3:1", "[2001:db8::11111]:1", + "293.283.1238.3:1", "[2001:db8::11111]:1", }; unsigned i; - for (i = 0; i < sizeof (kCases) / sizeof (*kCases); i++) - { - gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address (kCases[i], NULL, must_fail, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); - } + for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { + gpr_event ev; + gpr_event_init(&ev); + grpc_resolve_address(kCases[i], NULL, must_fail, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); + } } -static void -test_unparseable_hostports (void) -{ +static void test_unparseable_hostports(void) { const char *const kCases[] = { - "[", "[::1", "[::1]bad", "[1.2.3.4]", "[localhost]", "[localhost]:1", + "[", "[::1", "[::1]bad", "[1.2.3.4]", "[localhost]", "[localhost]:1", }; unsigned i; - for (i = 0; i < sizeof (kCases) / sizeof (*kCases); i++) - { - gpr_event ev; - gpr_event_init (&ev); - grpc_resolve_address (kCases[i], "1", must_fail, &ev); - GPR_ASSERT (gpr_event_wait (&ev, test_deadline ())); - } + for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { + gpr_event ev; + gpr_event_init(&ev); + grpc_resolve_address(kCases[i], "1", must_fail, &ev); + GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); + } } -int -main (int argc, char **argv) -{ - grpc_test_init (argc, argv); - grpc_iomgr_init (); - test_localhost (); - test_default_port (); - test_missing_default_port (); - test_ipv6_with_port (); - test_ipv6_without_port (); - test_invalid_ip_addresses (); - test_unparseable_hostports (); - grpc_iomgr_shutdown (); +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + grpc_iomgr_init(); + test_localhost(); + test_default_port(); + test_missing_default_port(); + test_ipv6_with_port(); + test_ipv6_without_port(); + test_invalid_ip_addresses(); + test_unparseable_hostports(); + grpc_iomgr_shutdown(); return 0; } |