OpenDNSSEC-enforcer 2.1.13
test.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
3 * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
4 * Copyright (c) 2014 OpenDNSSEC AB (svb)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#include "test.h"
31
32#include "test_hsm_key.h"
33#include "test_key_data.h"
34#include "test_key_state.h"
35#include "test_key_dependency.h"
36#include "test_policy.h"
37#include "test_policy_key.h"
39#include "test_zone.h"
40
41#include "CUnit/Basic.h"
42
43int main(void) {
44 CU_pSuite pSuite = NULL;
45
46 if (CUE_SUCCESS != CU_initialize_registry()) {
47 return CU_get_error();
48 }
49
50 pSuite = CU_add_suite("Classes", init_suite_classes, clean_suite_classes);
51 if (!pSuite) {
52 CU_cleanup_registry();
53 return CU_get_error();
54 }
55
56 if (!CU_add_test(pSuite, "test of db_backend_handle", test_class_db_backend_handle)
57 || !CU_add_test(pSuite, "test of db_backend", test_class_db_backend)
58 || !CU_add_test(pSuite, "test of db_clause", test_class_db_clause)
59 || !CU_add_test(pSuite, "test of db_clause_list", test_class_db_clause_list)
60 || !CU_add_test(pSuite, "test of db_configuration", test_class_db_configuration)
61 || !CU_add_test(pSuite, "test of db_configuration_list", test_class_db_configuration_list)
62 || !CU_add_test(pSuite, "test of db_connection", test_class_db_connection)
63 || !CU_add_test(pSuite, "test of db_object_field", test_class_db_object_field)
64 || !CU_add_test(pSuite, "test of db_object_field_list", test_class_db_object_field_list)
65 || !CU_add_test(pSuite, "test of db_object", test_class_db_object)
66 || !CU_add_test(pSuite, "test of db_value_set", test_class_db_value_set)
67 || !CU_add_test(pSuite, "test of db_result", test_class_db_result)
68 || !CU_add_test(pSuite, "test of db_result_list", test_class_db_result_list)
69 || !CU_add_test(pSuite, "test of db_value", test_class_db_value)
70 || !CU_add_test(pSuite, "test of db_*_free", test_class_end))
71 {
72 CU_cleanup_registry();
73 return CU_get_error();
74 }
75
76 pSuite = CU_add_suite("Initialization", init_suite_initialization, clean_suite_initialization);
77 if (!pSuite) {
78 CU_cleanup_registry();
79 return CU_get_error();
80 }
81
82 if (!CU_add_test(pSuite, "test of configuration", test_initialization_configuration)
83 || !CU_add_test(pSuite, "test of connection", test_initialization_connection))
84 {
85 CU_cleanup_registry();
86 return CU_get_error();
87 }
88
89#if defined(ENFORCER_DATABASE_SQLITE3)
90 pSuite = CU_add_suite("SQLite database operations", init_suite_database_operations_sqlite, clean_suite_database_operations);
91 if (!pSuite) {
92 CU_cleanup_registry();
93 return CU_get_error();
94 }
95
96 if (!CU_add_test(pSuite, "test of read object 1", test_database_operations_read_object1)
97 || !CU_add_test(pSuite, "test of create object 2", test_database_operations_create_object2)
98 || !CU_add_test(pSuite, "test of read object 2", test_database_operations_read_object2)
99 || !CU_add_test(pSuite, "test of read object 1 (#2)", test_database_operations_read_object1)
100 || !CU_add_test(pSuite, "test of create object 3", test_database_operations_create_object3)
101 || !CU_add_test(pSuite, "test of update object 2", test_database_operations_update_object2)
102 || !CU_add_test(pSuite, "test of read all", test_database_operations_read_all)
103 || !CU_add_test(pSuite, "test of count", test_database_operations_count)
104 || !CU_add_test(pSuite, "test of delete object 3", test_database_operations_delete_object3)
105 || !CU_add_test(pSuite, "test of read object 1 (#3)", test_database_operations_read_object1)
106 || !CU_add_test(pSuite, "test of delete object 2", test_database_operations_delete_object2)
107 || !CU_add_test(pSuite, "test of read object 1 (#4)", test_database_operations_read_object1)
108
109 || !CU_add_test(pSuite, "test of read object 1 (REV)", test_database_operations_read_object1_2)
110 || !CU_add_test(pSuite, "test of create object 2 (REV)", test_database_operations_create_object2_2)
111 || !CU_add_test(pSuite, "test of read object 2 (REV)", test_database_operations_read_object2_2)
112 || !CU_add_test(pSuite, "test of read object 1 (#2) (REV)", test_database_operations_read_object1_2)
113 || !CU_add_test(pSuite, "test of create object 3 (REV)", test_database_operations_create_object3_2)
114 || !CU_add_test(pSuite, "test of update object 2 (REV)", test_database_operations_update_object2_2)
115 || !CU_add_test(pSuite, "test of updates revisions (REV)", test_database_operations_update_objects_revisions)
116 || !CU_add_test(pSuite, "test of delete object 3 (REV)", test_database_operations_delete_object3_2)
117 || !CU_add_test(pSuite, "test of read object 1 (#3) (REV)", test_database_operations_read_object1_2)
118 || !CU_add_test(pSuite, "test of delete object 2 (REV)", test_database_operations_delete_object2_2)
119 || !CU_add_test(pSuite, "test of read object 1 (#4) (REV)", test_database_operations_read_object1_2))
120 {
121 CU_cleanup_registry();
122 return CU_get_error();
123 }
124#endif
125
126#if defined(ENFORCER_DATABASE_MYSQL)
127 pSuite = CU_add_suite("MySQL database operations", init_suite_database_operations_mysql, clean_suite_database_operations);
128 if (!pSuite) {
129 CU_cleanup_registry();
130 return CU_get_error();
131 }
132
133 if (!CU_add_test(pSuite, "test of read object 1", test_database_operations_read_object1)
134 || !CU_add_test(pSuite, "test of create object 2", test_database_operations_create_object2)
135 || !CU_add_test(pSuite, "test of read object 2", test_database_operations_read_object2)
136 || !CU_add_test(pSuite, "test of read object 1 (#2)", test_database_operations_read_object1)
137 || !CU_add_test(pSuite, "test of create object 3", test_database_operations_create_object3)
138 || !CU_add_test(pSuite, "test of update object 2", test_database_operations_update_object2)
139 || !CU_add_test(pSuite, "test of read all", test_database_operations_read_all)
140 || !CU_add_test(pSuite, "test of delete object 3", test_database_operations_delete_object3)
141 || !CU_add_test(pSuite, "test of read object 1 (#3)", test_database_operations_read_object1)
142 || !CU_add_test(pSuite, "test of delete object 2", test_database_operations_delete_object2)
143 || !CU_add_test(pSuite, "test of read object 1 (#4)", test_database_operations_read_object1)
144
145 || !CU_add_test(pSuite, "test of read object 1 (REV)", test_database_operations_read_object1_2)
146 || !CU_add_test(pSuite, "test of create object 2 (REV)", test_database_operations_create_object2_2)
147 || !CU_add_test(pSuite, "test of read object 2 (REV)", test_database_operations_read_object2_2)
148 || !CU_add_test(pSuite, "test of read object 1 (#2) (REV)", test_database_operations_read_object1_2)
149 || !CU_add_test(pSuite, "test of create object 3 (REV)", test_database_operations_create_object3_2)
150 || !CU_add_test(pSuite, "test of update object 2 (REV)", test_database_operations_update_object2_2)
151 || !CU_add_test(pSuite, "test of updates revisions (REV)", test_database_operations_update_objects_revisions)
152 || !CU_add_test(pSuite, "test of delete object 3 (REV)", test_database_operations_delete_object3_2)
153 || !CU_add_test(pSuite, "test of read object 1 (#3) (REV)", test_database_operations_read_object1_2)
154 || !CU_add_test(pSuite, "test of delete object 2 (REV)", test_database_operations_delete_object2_2)
155 || !CU_add_test(pSuite, "test of read object 1 (#4) (REV)", test_database_operations_read_object1_2))
156 {
157 CU_cleanup_registry();
158 return CU_get_error();
159 }
160#endif
161
170
171 CU_basic_set_mode(CU_BRM_VERBOSE);
172 CU_basic_run_tests();
173 CU_cleanup_registry();
174 return CU_get_error();
175}
int main(void)
Definition test.c:43
void test_database_operations_create_object3_2(void)
void test_database_operations_count(void)
void test_class_db_value_set(void)
void test_database_operations_create_object2_2(void)
void test_class_db_object(void)
int clean_suite_initialization(void)
int init_suite_classes(void)
void test_initialization_configuration(void)
void test_class_db_value(void)
void test_class_db_clause(void)
void test_class_db_connection(void)
void test_database_operations_create_object3(void)
void test_database_operations_delete_object3(void)
void test_database_operations_delete_object2(void)
int init_suite_database_operations_mysql(void)
void test_database_operations_read_object1(void)
void test_database_operations_update_object2(void)
void test_class_db_object_field_list(void)
void test_database_operations_create_object2(void)
void test_database_operations_read_object1_2(void)
void test_database_operations_read_object2_2(void)
int clean_suite_database_operations(void)
void test_initialization_connection(void)
void test_database_operations_read_all(void)
void test_database_operations_update_objects_revisions(void)
void test_class_end(void)
void test_database_operations_update_object2_2(void)
void test_class_db_object_field(void)
void test_database_operations_delete_object3_2(void)
int clean_suite_classes(void)
int init_suite_initialization(void)
void test_class_db_result_list(void)
void test_class_db_backend(void)
void test_database_operations_read_object2(void)
void test_class_db_configuration(void)
void test_class_db_clause_list(void)
void test_class_db_configuration_list(void)
void test_database_operations_delete_object2_2(void)
void test_class_db_backend_handle(void)
void test_class_db_result(void)
int test_database_version_add_suite(void)
int test_hsm_key_add_suite(void)
int test_key_data_add_suite(void)
int test_key_dependency_add_suite(void)
int test_key_state_add_suite(void)
int test_policy_add_suite(void)
int test_policy_key_add_suite(void)
int test_zone_add_suite(void)
Definition test_zone.c:852