cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: documenting unit tests for functions

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 11 May 2011 18:46:06 +0200 (CEST)

On Wed, 11 May 2011, Amr Shahin wrote:

> I'm back to adding unit tests for curl, and i think there should be an easy
> way for contributors to know whether a test is implemented for a certain
> function, what i have in mind is to add a comment looking pretty much like
> this:
>
> /* unit-tested
>
> * @file unit1300.c
>
> * @line 147
>
> * */

I think this is a good idea. I would however prefer it to be a more compact
more easily machine-parsed format, like perhaps:

/*
  * @unit-test: 1300
  */

... without reference to exact line number since that is doomed to change over
time, and unit-tests should preferably be focused on a single function in each
test anyway.

> I was wondering if it's best to add this to the .h file or the .c file

I say the .c file since we might end up with tests even for static functions
that have no prototypes in .h files.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-11