aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/tester.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2005-11-03 13:04:17 +0000
committerMartin Willi <martin@strongswan.org>2005-11-03 13:04:17 +0000
commitee4e57ac2a4aaca67836189b7b9a2ad746051b24 (patch)
tree1246a1975b5619f4fc97180918a0bbe3f221380c /Source/charon/tester.c
parent1db30ec757eabc4e3eb4df001fb0dd72495d40b0 (diff)
downloadstrongswan-ee4e57ac2a4aaca67836189b7b9a2ad746051b24.tar.bz2
strongswan-ee4e57ac2a4aaca67836189b7b9a2ad746051b24.tar.xz
- thread_pool test added
Diffstat (limited to 'Source/charon/tester.c')
-rw-r--r--Source/charon/tester.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/charon/tester.c b/Source/charon/tester.c
index 667fe8ef7..fb92a4d35 100644
--- a/Source/charon/tester.c
+++ b/Source/charon/tester.c
@@ -29,6 +29,7 @@
#include "tester.h"
#include "linked_list.h"
+#include "thread_pool.h"
/**
* @brief Private Variables and Functions of tester class
@@ -68,7 +69,8 @@ struct private_tester_s {
/**
* @brief Test function to test the linked list class
*/
-static void test_linked_list(private_tester_t * this){
+static void test_linked_list(private_tester_t *this)
+{
void *test_value = NULL;
linked_list_t *linked_list = linked_list_create();
@@ -83,7 +85,6 @@ static void test_linked_list(private_tester_t * this){
this->assert_true(this,(linked_list->get_last(linked_list,&test_value) == SUCCESS), "get_last call check");
this->assert_true(this,(strcmp((char *) test_value,"one") == 0), "get_last value check");
-
this->assert_true(this,(linked_list->remove_first(linked_list,&test_value) == SUCCESS), "remove_first call check");
this->assert_true(this,(strcmp((char *) test_value,"five") == 0), "remove_first value check");
@@ -106,6 +107,19 @@ static void test_linked_list(private_tester_t * this){
}
/**
+ * @brief Test function to test the thread pool class
+ */
+static void test_thread_pool(private_tester_t *this)
+{
+ size_t pool_size;
+ size_t desired_pool_size = 10;
+ thread_pool_t *pool = thread_pool_create(desired_pool_size);
+ pool->get_pool_size(pool, &pool_size);
+ this->assert_true(this, (desired_pool_size == pool_size), "thread creation");
+ pool->destroy(pool);
+}
+
+/**
* @brief Testing of all registered tests
*
* New tests have to be added in this function
@@ -117,6 +131,7 @@ static status_t test_all(tester_t *tester)
/* Add new Tests here! */
this->run_test(this,test_linked_list,"Linked List");
+ this->run_test(this,test_thread_pool,"Thread Pool");
fprintf(this->output,"End testing. %d tests failed of %d tests\n",this->failed_tests_count,this->tests_count);