diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 20:28:34 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 22:38:36 +0200 |
commit | a71012c03ef6a7cbfba69bcafb559fa417c49af0 (patch) | |
tree | db917bd1712346053d67108c494e4424ba290e07 /tests/unit | |
parent | 9d194a1143f280dfd5174108b27edd51d909383d (diff) |
code: style updates
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/unit1301.c | 20 | ||||
-rw-r--r-- | tests/unit/unit1302.c | 20 | ||||
-rw-r--r-- | tests/unit/unit1303.c | 4 | ||||
-rw-r--r-- | tests/unit/unit1305.c | 4 | ||||
-rw-r--r-- | tests/unit/unit1307.c | 8 | ||||
-rw-r--r-- | tests/unit/unit1397.c | 18 | ||||
-rw-r--r-- | tests/unit/unit1398.c | 26 | ||||
-rw-r--r-- | tests/unit/unit1602.c | 4 | ||||
-rw-r--r-- | tests/unit/unit1603.c | 6 |
9 files changed, 55 insertions, 55 deletions
diff --git a/tests/unit/unit1301.c b/tests/unit/unit1301.c index a50fc67d6..928076e29 100644 --- a/tests/unit/unit1301.c +++ b/tests/unit/unit1301.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,32 +23,32 @@ #include "strequal.h" -static CURLcode unit_setup( void ) {return CURLE_OK;} -static void unit_stop( void ) {} +static CURLcode unit_setup(void) {return CURLE_OK;} +static void unit_stop(void) {} UNITTEST_START int rc; rc = curl_strequal("iii", "III"); -fail_unless( rc != 0 , "return code should be zero" ); +fail_unless(rc != 0, "return code should be zero"); rc = curl_strequal("iiia", "III"); -fail_unless( rc == 0 , "return code should be zero" ); +fail_unless(rc == 0, "return code should be zero"); rc = curl_strequal("iii", "IIIa"); -fail_unless( rc == 0 , "return code should be zero" ); +fail_unless(rc == 0, "return code should be zero"); rc = curl_strequal("iiiA", "IIIa"); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("iii", "III", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("iiiABC", "IIIcba", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("ii", "II", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); UNITTEST_STOP diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index bc180f77d..66054da57 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -28,7 +28,7 @@ static struct SessionHandle *data; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { data = curl_easy_init(); if(!data) @@ -36,7 +36,7 @@ static CURLcode unit_setup( void ) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { curl_easy_cleanup(data); } @@ -52,50 +52,50 @@ CURLcode rc; rc = Curl_base64_encode(data, "i", 1, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aQ==", 4); +verify_memory(output, "aQ==", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "ii", 2, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aWk=", 4); +verify_memory(output, "aWk=", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "iii", 3, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aWlp", 4); +verify_memory(output, "aWlp", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "iiii", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); rc = Curl_base64_encode(data, "\xff\x01\xfe\x02", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "/wH+Ag==", 8); +verify_memory(output, "/wH+Ag==", 8); Curl_safefree(output); rc = Curl_base64url_encode(data, "\xff\x01\xfe\x02", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "_wH-Ag==", 8); +verify_memory(output, "_wH-Ag==", 8); Curl_safefree(output); rc = Curl_base64url_encode(data, "iiii", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); /* 0 length makes it do strlen() */ rc = Curl_base64_encode(data, "iiii", 0, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); rc = Curl_base64_decode("aWlpaQ==", &decoded, &size); diff --git a/tests/unit/unit1303.c b/tests/unit/unit1303.c index 0d655b7bf..7c0731a47 100644 --- a/tests/unit/unit1303.c +++ b/tests/unit/unit1303.c @@ -27,7 +27,7 @@ static struct SessionHandle *data; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { data = curl_easy_init(); if(!data) @@ -35,7 +35,7 @@ static CURLcode unit_setup( void ) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { curl_easy_cleanup(data); } diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c index 093333a79..95cfe2b5d 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -44,7 +44,7 @@ static struct curl_hash hp; static char *data_key; static struct Curl_dns_entry *data_node; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { int rc; data = curl_easy_init(); @@ -60,7 +60,7 @@ static CURLcode unit_setup( void ) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { if(data_node) { Curl_freeaddrinfo(data_node->addr); diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 89f49832f..576462274 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -160,7 +160,7 @@ static const struct testcase tests[] = { { "****.txt", ".txt", MATCH }, /* empty string or pattern */ - { "", "", MATCH } , + { "", "", MATCH }, { "", "hello", NOMATCH }, { "file", "", NOMATCH }, { "?", "", NOMATCH }, @@ -208,12 +208,12 @@ static const struct testcase tests[] = { { "", "", MATCH } }; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { } diff --git a/tests/unit/unit1397.c b/tests/unit/unit1397.c index 37e8e49de..539433ca0 100644 --- a/tests/unit/unit1397.c +++ b/tests/unit/unit1397.c @@ -28,7 +28,7 @@ static CURLcode unit_setup(void) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { /* done before shutting down and exiting */ } @@ -51,14 +51,14 @@ fail_unless(Curl_cert_hostcheck("f*.example.com", "foo.example.com"), fail_unless(Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"), "good 5"); -fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1" ); -fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2" ); -fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3" ); -fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4" ); -fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5" ); -fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6" ); -fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7" ); -fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8" ); +fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1"); +fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2"); +fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3"); +fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4"); +fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5"); +fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6"); +fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7"); +fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8"); fail_if(Curl_cert_hostcheck("*.example.", "www.example"), "bad 9"); fail_if(Curl_cert_hostcheck("", "www"), "bad 10"); fail_if(Curl_cert_hostcheck("*", "www"), "bad 11"); diff --git a/tests/unit/unit1398.c b/tests/unit/unit1398.c index e9cc6753c..9491c46c5 100644 --- a/tests/unit/unit1398.c +++ b/tests/unit/unit1398.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,8 +23,8 @@ #include "curl/mprintf.h" -static CURLcode unit_setup( void ) {return CURLE_OK;} -static void unit_stop( void ) {} +static CURLcode unit_setup(void) {return CURLE_OK;} +static void unit_stop(void) {} UNITTEST_START @@ -38,54 +38,54 @@ char output[24]; /* without a trailing zero */ rc = curl_msnprintf(output, 4, "%.*s", width, buf); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); /* with a trailing zero */ rc = curl_msnprintf(output, 4, "%.*s", width, str); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); width = 2; /* one byte less */ rc = curl_msnprintf(output, 4, "%.*s", width, buf); -fail_unless( rc == 2 , "return code should be 2" ); +fail_unless(rc == 2, "return code should be 2"); fail_unless(!strcmp(output, "bu"), "wrong output"); /* string with larger precision */ rc = curl_msnprintf(output, 8, "%.8s", str); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); /* longer string with precision */ rc = curl_msnprintf(output, 8, "%.3s", "0123456789"); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "012"), "wrong output"); /* negative width */ rc = curl_msnprintf(output, 8, "%-8s", str); -fail_unless( rc == 8 , "return code should be 8" ); +fail_unless(rc == 8, "return code should be 8"); fail_unless(!strcmp(output, "bug "), "wrong output"); /* larger width that string length */ rc = curl_msnprintf(output, 8, "%8s", str); -fail_unless( rc == 8 , "return code should be 8" ); +fail_unless(rc == 8, "return code should be 8"); fail_unless(!strcmp(output, " bu"), "wrong output"); /* output a number in a limited output */ rc = curl_msnprintf(output, 4, "%d", 10240); /* TODO: this should return 5 to be POSIX/snprintf compliant! */ -fail_unless( rc == 4 , "return code should be 4" ); +fail_unless(rc == 4, "return code should be 4"); fail_unless(!strcmp(output, "102"), "wrong output"); /* padded strings */ rc = curl_msnprintf(output, 16, "%8s%8s", str, str); -fail_unless( rc == 16 , "return code should be 16" ); +fail_unless(rc == 16, "return code should be 16"); fail_unless(!strcmp(output, " bug bu"), "wrong output"); /* padded numbers */ rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678); -fail_unless( rc == 16 , "return code should be 16" ); +fail_unless(rc == 16, "return code should be 16"); fail_unless(!strcmp(output, " 1234 567"), "wrong output"); UNITTEST_STOP diff --git a/tests/unit/unit1602.c b/tests/unit/unit1602.c index 0d56f9cd9..c67c0a555 100644 --- a/tests/unit/unit1602.c +++ b/tests/unit/unit1602.c @@ -36,13 +36,13 @@ static void mydtor(void *p) free(ptr); } -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return Curl_hash_init(&hash_static, 7, Curl_hash_str, Curl_str_key_compare, mydtor); } -static void unit_stop( void ) +static void unit_stop(void) { Curl_hash_destroy(&hash_static); } diff --git a/tests/unit/unit1603.c b/tests/unit/unit1603.c index ffcd756e2..c20b20b0e 100644 --- a/tests/unit/unit1603.c +++ b/tests/unit/unit1603.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2015 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,13 +37,13 @@ static void mydtor(void *p) (void)p; /* unused */ } -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return Curl_hash_init(&hash_static, slots, Curl_hash_str, Curl_str_key_compare, mydtor); } -static void unit_stop( void ) +static void unit_stop(void) { Curl_hash_destroy(&hash_static); } |