Skip to content

Commit

Permalink
unittest: mark all unit tested functions
Browse files Browse the repository at this point in the history
With "@UnitTest: [num]" in the header comment for each tested function.
Shows we have a log way to go still...
  • Loading branch information
bagder committed Jun 10, 2011
1 parent d5cc77b commit 0f7bea7
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lib/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions lib/curl_fnmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/formdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion lib/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
10 changes: 7 additions & 3 deletions lib/llist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion lib/netrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, 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
Expand Down Expand Up @@ -61,6 +61,9 @@ enum host_lookup_state {
HOSTEND /* LAST enum */
};

/*
* @unittest: 1304
*/
int Curl_parsenetrc(const char *host,
char *login,
char *password,
Expand Down
8 changes: 7 additions & 1 deletion lib/strequal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, 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
Expand All @@ -31,6 +31,9 @@

#include "strequal.h"

/*
* @unittest: 1301
*/
int curl_strequal(const char *first, const char *second)
{
#if defined(HAVE_STRCASECMP)
Expand All @@ -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)
Expand Down

0 comments on commit 0f7bea7

Please sign in to comment.