32 #include "../db_configuration.h"
33 #include "../db_connection.h"
34 #include "../db_object.h"
36 #include "CUnit/Basic.h"
54 static test_t* test = NULL;
114 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
120 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
126 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
127 CU_ASSERT_PTR_NOT_NULL_FATAL(name);
132 test->
name = strdup(name);
133 CU_ASSERT_PTR_NOT_NULL_FATAL(test->
name);
140 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
141 CU_ASSERT_PTR_NOT_NULL_FATAL(result);
151 CU_ASSERT_PTR_NOT_NULL_FATAL(value_set);
165 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
166 CU_ASSERT_PTR_NOT_NULL_FATAL(name);
205 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
206 CU_ASSERT_PTR_NOT_NULL_FATAL(
id);
245 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
247 CU_ASSERT_PTR_NOT_NULL_FATAL(test->
name);
280 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
282 CU_ASSERT_PTR_NOT_NULL_FATAL(test->
name);
321 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
347 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
348 CU_ASSERT_PTR_NOT_NULL_FATAL(name);
370 CU_ASSERT_PTR_NOT_NULL_FATAL(test);
371 CU_ASSERT_PTR_NOT_NULL_FATAL(
id);
401 if (test_list->
dbo) {
407 if (test_list->
test) {
415 CU_ASSERT_PTR_NOT_NULL_FATAL(test_list);
416 CU_ASSERT_PTR_NOT_NULL_FATAL(test_list->
dbo);
431 CU_ASSERT_PTR_NOT_NULL_FATAL(test_list);
432 CU_ASSERT_PTR_NOT_NULL_FATAL(test_list->
result_list);
438 if (!test_list->
test) {
444 return test_list->
test;
450 CU_ASSERT_PTR_NOT_NULL_FATAL(test_list);
456 if (!test_list->
test) {
462 return test_list->
test;
473 static test2_t* test2_2 = NULL;
540 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
546 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
552 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
553 CU_ASSERT_PTR_NOT_NULL_FATAL(name);
558 test2->
name = strdup(name);
559 CU_ASSERT_PTR_NOT_NULL_FATAL(test2->
name);
566 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
567 CU_ASSERT_PTR_NOT_NULL_FATAL(result);
578 CU_ASSERT_PTR_NOT_NULL_FATAL(value_set);
593 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
594 CU_ASSERT_PTR_NOT_NULL_FATAL(name);
633 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
634 CU_ASSERT_PTR_NOT_NULL_FATAL(
id);
673 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
676 CU_ASSERT_PTR_NOT_NULL_FATAL(test2->
name);
709 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
712 CU_ASSERT_PTR_NOT_NULL_FATAL(test2->
name);
756 CU_ASSERT_PTR_NOT_NULL_FATAL(test2);
784 #if defined(ENFORCER_DATABASE_SQLITE3)
785 int init_suite_database_operations_sqlite(
void) {
786 if (configuration_list) {
817 configuration = NULL;
819 configuration_list = NULL;
822 configuration = NULL;
829 configuration = NULL;
831 configuration_list = NULL;
834 configuration = NULL;
845 configuration_list = NULL;
848 configuration_list = NULL;
862 #if defined(ENFORCER_DATABASE_MYSQL)
864 if (configuration_list) {
895 configuration = NULL;
897 configuration_list = NULL;
900 configuration = NULL;
907 configuration = NULL;
909 configuration_list = NULL;
912 configuration = NULL;
919 configuration = NULL;
921 configuration_list = NULL;
924 configuration = NULL;
931 configuration = NULL;
933 configuration_list = NULL;
936 configuration = NULL;
943 configuration = NULL;
945 configuration_list = NULL;
948 configuration = NULL;
955 configuration = NULL;
957 configuration_list = NULL;
960 configuration = NULL;
971 configuration_list = NULL;
974 configuration_list = NULL;
1000 configuration = NULL;
1002 configuration_list = NULL;
1015 CU_ASSERT_PTR_NOT_NULL(
id);
1039 CU_ASSERT(!strcmp(text, id_text));
1043 CU_FAIL(
"db_value_type(id)");
1048 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1051 CU_ASSERT_PTR_NOT_NULL_FATAL(
test_name(test));
1052 CU_ASSERT(!strcmp(
test_name(test),
"test"));
1056 CU_PASS(
"test_free");
1060 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1062 CU_ASSERT(!strcmp(
test_name(test),
"name 2"));
1067 CU_PASS(
"test_free");
1069 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1073 CU_ASSERT(!strcmp(
test_name(test),
"name 2"));
1077 CU_PASS(
"test_free");
1083 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1087 CU_ASSERT(!strcmp(
test_name(test),
"name 2"));
1091 CU_PASS(
"test_free");
1095 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1098 CU_ASSERT(!strcmp(
test_name(test),
"name 3"));
1103 CU_PASS(
"test_free");
1105 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1107 CU_ASSERT(!strcmp(
test_name(test),
"name 3"));
1111 CU_PASS(
"test_free");
1115 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1121 CU_PASS(
"test_free");
1123 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1128 CU_PASS(
"test_free");
1132 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1134 CU_ASSERT(!strcmp(
test_name(test),
"name 3"));
1139 CU_PASS(
"test_free");
1141 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1145 CU_ASSERT(!strcmp(
test_name(test),
"name 3"));
1149 CU_PASS(
"test_free");
1153 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1159 CU_PASS(
"test_free");
1161 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1166 CU_PASS(
"test_free");
1170 const test_t* local_test;
1173 CU_ASSERT_PTR_NOT_NULL_FATAL((test_list =
test_list_new(connection)));
1176 while (local_test) {
1180 CU_ASSERT(count == 3);
1184 CU_PASS(
"test_list_free");
1188 CU_ASSERT_PTR_NOT_NULL_FATAL((test =
test_new(connection)));
1195 CU_PASS(
"test_free");
1199 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1202 CU_ASSERT_PTR_NOT_NULL_FATAL(
test2_name(test2));
1203 CU_ASSERT(!strcmp(
test2_name(test2),
"test"));
1207 CU_PASS(
"test2_free");
1211 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1213 CU_ASSERT(!strcmp(
test2_name(test2),
"name 2"));
1218 CU_PASS(
"test2_free");
1220 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1224 CU_ASSERT(!strcmp(
test2_name(test2),
"name 2"));
1228 CU_PASS(
"test2_free");
1234 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1238 CU_ASSERT(!strcmp(
test2_name(test2),
"name 2"));
1242 CU_PASS(
"test2_free");
1246 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1249 CU_ASSERT(!strcmp(
test2_name(test2),
"name 3"));
1254 CU_PASS(
"test2_free");
1256 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1258 CU_ASSERT(!strcmp(
test2_name(test2),
"name 3"));
1262 CU_PASS(
"test2_free");
1266 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1268 CU_ASSERT(!strcmp(
test2_name(test2),
"name 4"));
1273 CU_PASS(
"test2_free");
1275 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1277 CU_ASSERT(!strcmp(
test2_name(test2),
"name 4"));
1279 CU_ASSERT_PTR_NOT_NULL_FATAL((test2_2 =
test2_new(connection)));
1281 CU_ASSERT(!strcmp(
test2_name(test2_2),
"name 4"));
1284 CU_ASSERT(!strcmp(
test2_name(test2_2),
"name 5"));
1288 CU_ASSERT(!strcmp(
test2_name(test2),
"name 5"));
1293 CU_PASS(
"test2_free");
1297 CU_PASS(
"test2_free");
1301 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1307 CU_PASS(
"test2_free");
1309 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1314 CU_PASS(
"test2_free");
1318 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1320 CU_ASSERT(!strcmp(
test2_name(test2),
"name 3"));
1325 CU_PASS(
"test2_free");
1327 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1331 CU_ASSERT(!strcmp(
test2_name(test2),
"name 3"));
1335 CU_PASS(
"test2_free");
1339 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1345 CU_PASS(
"test2_free");
1347 CU_ASSERT_PTR_NOT_NULL_FATAL((test2 =
test2_new(connection)));
1352 CU_PASS(
"test2_free");