- event_queue_test improved
[strongswan.git] / Source / charon / tests.c
1 /**
2 * @file tests.c
3 *
4 * @brief Main for all tests
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23
24 #include <stdio.h>
25 #
26 #include "tester.h"
27 #include "job_queue.h"
28 #include "tests/linked_list_test.h"
29 #include "tests/thread_pool_test.h"
30 #include "tests/job_queue_test.h"
31 #include "tests/event_queue_test.h"
32 #include "tests/send_queue_test.h"
33 #include "tests/socket_test.h"
34
35
36 /* output for test messages */
37 extern FILE * stderr;
38
39
40 /**
41 * Test for linked_list_t
42 */
43 test_t linked_list_test = {test_linked_list,"Linked List"};
44
45 /**
46 * Test for linked_list_t with iterator
47 */
48 test_t linked_list_iterator_test = {test_linked_list_iterator,"Linked List Iterator"};
49
50 /**
51 * Test for linked_list_t insert and remove
52 */
53 test_t linked_list_insert_and_remove_test = {test_linked_list_insert_and_remove,"Linked List Insert and remove"};
54
55 /**
56 * Test for event_queue_t
57 */
58 test_t event_queue_test = {test_event_queue,"Event-Queue Test"};
59
60 /**
61 * Test 1 for job_queue_t
62 */
63 test_t job_queue_test1 = {test_job_queue,"Job-Queue Test1"};
64
65 /**
66 * Test 1 for linked_list_t
67 */
68 test_t send_queue_test = {test_send_queue,"Send-Queue Test"};
69
70 /**
71 * Test for socket_t
72 */
73 test_t socket_test = {test_socket,"Socket"};
74
75 /**
76 * Test for thread_pool_t
77 */
78 test_t thread_pool_test = {test_thread_pool,"Thread Pool"};
79
80 job_queue_t *job_queue;
81
82 int main()
83 {
84 FILE * test_output = stderr;
85
86 test_t *all_tests[] ={
87 &linked_list_test,
88 &linked_list_iterator_test,
89 &linked_list_insert_and_remove_test,
90 &thread_pool_test,
91 &job_queue_test1,
92 &event_queue_test,
93 &send_queue_test,
94 &socket_test,
95 NULL
96 };
97
98 job_queue = job_queue_create();
99
100 tester_t *tester = tester_create(test_output, FALSE);
101
102 tester->perform_tests(tester,all_tests);
103 // tester->perform_test(tester,&event_queue_test);
104
105 tester->destroy(tester);
106
107 job_queue->destroy(job_queue);
108
109 #ifdef LEAK_DETECTIVE
110 /* Leaks are reported in log file */
111 report_leaks();
112 #endif
113
114 return 0;
115 }