From 0f7bea7c3a6ddb0bf43f890c764322faaa3ba561 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 10 Jun 2011 14:40:46 +0200 Subject: [PATCH] unittest: mark all unit tested functions With "@unittest: [num]" in the header comment for each tested function. Shows we have a log way to go still... --- lib/base64.c | 3 +++ lib/connect.c | 2 ++ lib/curl_fnmatch.c | 3 +++ lib/formdata.c | 4 ++++ lib/hash.c | 5 ++++- lib/llist.c | 10 +++++++--- lib/netrc.c | 5 ++++- lib/strequal.c | 8 +++++++- 8 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/base64.c b/lib/base64.c index 3e59f5f46..0de1f0100 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -73,6 +73,8 @@ static void decodeQuantum(unsigned char *dest, const char *src) * * Given a base64 string at src, decode it and return an allocated memory in * the *outptr. Returns the length of the decoded data. + * + * @unittest: 1302 */ size_t Curl_base64_decode(const char *src, unsigned char **outptr) { @@ -135,6 +137,7 @@ size_t Curl_base64_decode(const char *src, unsigned char **outptr) * is a pointer to an allocated area holding the base64 data. If something * went wrong, 0 is returned. * + * @unittest: 1302 */ size_t Curl_base64_encode(struct SessionHandle *data, const char *inputbuff, size_t insize, diff --git a/lib/connect.c b/lib/connect.c index 6d657eb5e..a9185978c 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -131,6 +131,8 @@ singleipconnect(struct connectdata *conn, * If 'nowp' is non-NULL, it points to the current time. * 'duringconnect' is FALSE if not during a connect, as then of course the * connect timeout is not taken into account! + * + * @unittest: 1303 */ long Curl_timeleft(struct SessionHandle *data, struct timeval *nowp, diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c index b1c91ad1b..e18f52eab 100644 --- a/lib/curl_fnmatch.c +++ b/lib/curl_fnmatch.c @@ -413,6 +413,9 @@ static int loop(const unsigned char *pattern, const unsigned char *string) } } +/* + * @unittest: 1307 + */ int Curl_fnmatch(void *ptr, const char *pattern, const char *string) { (void)ptr; /* the argument is specified by the curl_fnmatch_callback diff --git a/lib/formdata.c b/lib/formdata.c index a7d2a5f7c..df4094c33 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -737,6 +737,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, /* * curl_formadd() is a public API to add a section to the multipart formpost. + * + * @unittest: 1308 */ CURLFORMcode curl_formadd(struct curl_httppost **httppost, @@ -858,6 +860,8 @@ void Curl_formclean(struct FormData **form_ptr) * curl_formget() * Serialize a curl_httppost struct. * Returns 0 on success. + * + * @unittest: 1308 */ int curl_formget(struct curl_httppost *form, void *arg, curl_formget_callback append) diff --git a/lib/hash.c b/lib/hash.c index 3a3a58e90..6c921e442 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -140,7 +140,10 @@ mk_hash_element(const void *key, size_t key_len, const void *p) #define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)] /* Insert the data in the hash. If there already was a match in the hash, - that data is replaced. */ + * that data is replaced. + * + * @unittest: 1305 + */ void * Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p) { diff --git a/lib/llist.c b/lib/llist.c index 42364b121..9478a708d 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -62,6 +62,8 @@ Curl_llist_alloc(curl_llist_dtor dtor) * inserted first in the list. * * Returns: 1 on success and 0 on failure. + * + * @unittest: 1300 */ int Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e, @@ -101,9 +103,11 @@ Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e, return 1; } -int -Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e, - void *user) +/* + * @unittest: 1300 + */ +int Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e, + void *user) { if(e == NULL || list->size == 0) return 1; diff --git a/lib/netrc.c b/lib/netrc.c index efb4076bb..5541a2f29 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -61,6 +61,9 @@ enum host_lookup_state { HOSTEND /* LAST enum */ }; +/* + * @unittest: 1304 + */ int Curl_parsenetrc(const char *host, char *login, char *password, diff --git a/lib/strequal.c b/lib/strequal.c index f6bf5f3b9..15896b9fd 100644 --- a/lib/strequal.c +++ b/lib/strequal.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -31,6 +31,9 @@ #include "strequal.h" +/* + * @unittest: 1301 + */ int curl_strequal(const char *first, const char *second) { #if defined(HAVE_STRCASECMP) @@ -51,6 +54,9 @@ int curl_strequal(const char *first, const char *second) #endif } +/* + * @unittest: 1301 + */ int curl_strnequal(const char *first, const char *second, size_t max) { #if defined(HAVE_STRNCASECMP)