cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl unit testing

From: Amr Shahin <amrnablus_at_gmail.com>
Date: Sat, 1 Jan 2011 02:50:54 +0200

Hello folks,

i'm attaching a sample very small unit tests using both check unit testing
library and the current curl testing framework integrated with curl, i was
hoping we could asses both and see which is more suitable to write unit
tests.

the code uses check is in the file llist_test.c. It's a classic unit testing
code, with all basic functions there setup, teardown and macros for defining
your tests, the output is well organized, you can see sample output for both
all success, and one failed test in the attached files.
The only downside for using check is that we're adding an extra dependency
to curl, my suggesstion is to add the .so version and check.h to the code
base.

the other option is to use the testing setup already in libtest directory,
it's pretty easy to add more tests, but it's not as well-organized as using
check, all the tests use a function "int test(char *URL)" which may not be
suitable for unit tests.

personally, i'm into using check. I'd love to hear what you guys think?

*Amr*

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2011-01-01