aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/tester.c
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-11-07 08:57:57 +0000
committerJan Hutter <jhutter@hsr.ch>2005-11-07 08:57:57 +0000
commite15f7292ec4663977c1ee0414634ca738949a087 (patch)
tree59ccfa72d85a0a46543e4260c2e9934d01b9fcde /Source/charon/tester.c
parentfd9cabd4e68d85877a442ae2fff53c87e687f42b (diff)
downloadstrongswan-e15f7292ec4663977c1ee0414634ca738949a087.tar.bz2
strongswan-e15f7292ec4663977c1ee0414634ca738949a087.tar.xz
- tester_t class rewritten
- test for send_queue_t added
Diffstat (limited to 'Source/charon/tester.c')
-rw-r--r--Source/charon/tester.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/charon/tester.c b/Source/charon/tester.c
index 0c6fb0680..20b07ec65 100644
--- a/Source/charon/tester.c
+++ b/Source/charon/tester.c
@@ -43,6 +43,11 @@ typedef struct private_tester_s private_tester_t;
struct private_tester_s {
tester_t public;
+
+ /* Private functions */
+ void (*run_test) (tester_t *tester, void (*test_function) (tester_t * tester), char * test_name);
+
+
/* Private values */
FILE* output;
int tests_count;
@@ -53,9 +58,9 @@ struct private_tester_s {
};
/*
- * Implementation of function test_all
+ * Implementation of function perform_tests
*/
-static status_t test_all(tester_t *tester,test_t **tests)
+static status_t perform_tests(tester_t *tester,test_t **tests)
{
private_tester_t *this =(private_tester_t*) tester;
int current_test = 0;
@@ -63,7 +68,7 @@ static status_t test_all(tester_t *tester,test_t **tests)
while (tests[current_test] != NULL)
{
- tester->run_test(tester,tests[current_test]->test_function,tests[current_test]->test_name);
+ this->run_test(tester,tests[current_test]->test_function,tests[current_test]->test_name);
current_test++;
}
@@ -72,6 +77,15 @@ static status_t test_all(tester_t *tester,test_t **tests)
return SUCCESS;
}
+/*
+ * Implementation of function perform_test
+ */
+static status_t perform_test(tester_t *tester, test_t *test)
+{
+ test_t *tests[] = {test, NULL};
+ return (perform_tests(tester,tests));
+}
+
/**
* Returns the difference of to timeval structs in microseconds
*
@@ -168,11 +182,13 @@ tester_t *tester_create(FILE *output, bool display_succeeded_asserts)
private_tester_t *this = alloc_thing(private_tester_t, "private_tester_t");
this->public.destroy = destroy;
- this->public.test_all = test_all;
- this->public.run_test = run_test;
+ this->public.perform_tests = perform_tests;
+ this->public.perform_test = perform_test;
this->public.assert_true = assert_true;
this->public.assert_false = assert_false;
-
+
+
+ this->run_test = run_test;
this->display_succeeded_asserts = display_succeeded_asserts;
this->failed_tests_count = 0;
this->tests_count = 0;