aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/unit1300.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-01 17:33:42 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-03 19:38:10 +0100
commit35e1d6538a8767526b9cae66134441b146503a21 (patch)
tree871888fc2da33021b88546f78c33e90add2d675b /tests/unit/unit1300.c
parent45cea7196870f2b5e7096a619dc1a9725295ca1a (diff)
downloadgnurl-35e1d6538a8767526b9cae66134441b146503a21.tar.gz
gnurl-35e1d6538a8767526b9cae66134441b146503a21.tar.bz2
gnurl-35e1d6538a8767526b9cae66134441b146503a21.zip
unittest: framework for unit-testing
This is the first approach at doing fairly clean and easy to write and debug unit tests.
Diffstat (limited to 'tests/unit/unit1300.c')
-rw-r--r--tests/unit/unit1300.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c
new file mode 100644
index 000000000..92c0a7ac9
--- /dev/null
+++ b/tests/unit/unit1300.c
@@ -0,0 +1,34 @@
+#include <stdlib.h>
+#include "curl_config.h"
+#include "setup.h"
+
+#include "llist.h"
+#include "curlcheck.h"
+
+struct curl_llist *llist;
+
+static void test_curl_llist_dtor(void *key , void *value)
+{
+ /* used by the llist API, does nothing here */
+ (void)key;
+ (void)value;
+}
+
+static void unit_setup( void )
+{
+ llist = Curl_llist_alloc( test_curl_llist_dtor );
+}
+
+static void unit_stop( void )
+{
+ Curl_llist_destroy( llist, NULL );
+}
+
+UNITTEST_START
+
+ fail_unless( llist->size == 0 , "list initial size should be zero" );
+ fail_unless( llist->head == NULL , "list head should initiate to NULL" );
+ fail_unless( llist->tail == NULL , "list tail should intiate to NULL" );
+ fail_unless( llist->dtor == test_curl_llist_dtor , "list dtor shold initiate to test_curl_llist_dtor" );
+
+UNITTEST_STOP