curl-library
Re: [PATCH] adding unit test for Curl_llist_move and documenting unit-tested functions in llist.c
Date: Thu, 16 Jun 2011 13:03:15 -0700
On Thu, Jun 16, 2011 at 07:32:13PM +0300, Amr Shahin wrote:
> @@ -35,14 +37,19 @@ static void test_curl_llist_dtor(void *key, void *value)
> static CURLcode unit_setup(void)
> {
> llist = Curl_llist_alloc(test_curl_llist_dtor);
> - if (!llist)
> + if(!llist)
> return CURLE_OUT_OF_MEMORY;
> + llist_destination = Curl_llist_alloc(test_curl_llist_dtor);
> + if(!llist)
This should be if (!llist_destination)
> + /*
> + * @setup
> + * add one element to the list
> + */
> +
> + curlErrCode = Curl_llist_insert_next(llist, llist->head, &unusedData_case1);
> + /* necessary assertions */
> +
> + assert(curlErrCode == 1);
> + assert(Curl_llist_count(llist) == 1);
> + assert(Curl_llist_count(llist_destination) == 0);
These shouldn't use assert but rather abort_unless.
> + /*actual testing code*/
> + curlErrCode = Curl_llist_move(llist, llist->head, llist_destination, NULL);
> + assert(curlErrCode == 1);
Same here.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-16