summaryrefslogtreecommitdiffstats
path: root/ini/ini_config_ut.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-07-02 19:22:33 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-07-02 20:02:34 -0400
commit93ddfbe39c99c9d4a1b4c0b75c1e657c64c883b8 (patch)
tree8368d89ffecfd44bbd6ce7af6c0cd0c9d0095473 /ini/ini_config_ut.c
parent767ce0e4fdc9dee525561314311a461e77883b9b (diff)
downloadding-libs-93ddfbe39c99c9d4a1b4c0b75c1e657c64c883b8.tar.gz
ding-libs-93ddfbe39c99c9d4a1b4c0b75c1e657c64c883b8.tar.xz
ding-libs-93ddfbe39c99c9d4a1b4c0b75c1e657c64c883b8.zip
Adding wrappers to free data in INI API.
See ticket #37 in sssd track.
Diffstat (limited to 'ini/ini_config_ut.c')
-rw-r--r--ini/ini_config_ut.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/ini/ini_config_ut.c b/ini/ini_config_ut.c
index ce37921..2491273 100644
--- a/ini/ini_config_ut.c
+++ b/ini/ini_config_ut.c
@@ -51,8 +51,8 @@ int basic_test()
printf("----------------------\n\n\n");
- col_destroy_collection(ini_config);
- col_destroy_collection(error_set);
+ free_ini_config(ini_config);
+ free_ini_config_errors(error_set);
return 0;
}
@@ -86,8 +86,8 @@ int single_file()
printf("----------------------\n\n\n");
- col_destroy_collection(ini_config);
- col_destroy_collection(error_set);
+ free_ini_config(ini_config);
+ free_ini_config_errors(error_set);
ini_config = NULL;
error_set = NULL;
@@ -111,9 +111,9 @@ int single_file()
printf("----------------------\n\n\n");
- col_destroy_collection(ini_config);
- col_destroy_collection(error_set);
- col_destroy_collection(lines);
+ free_ini_config(ini_config);
+ free_ini_config_errors(error_set);
+ free_ini_config_lines(lines);
return 0;
}
@@ -160,7 +160,7 @@ int negative_test()
return -1;
}
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return 0;
}
@@ -236,8 +236,8 @@ int real_test(const char *file)
printf("About to clean up.\n");
col_unbind_iterator(iterator);
- col_destroy_collection(ini_config);
- col_destroy_collection(error_set);
+ free_ini_config(ini_config);
+ free_ini_config_errors(error_set);
return 0;
}
@@ -280,7 +280,7 @@ int get_test()
col_debug_collection(ini_config, COL_TRAVERSE_DEFAULT);
printf("Debugging the error collection:\n");
col_debug_collection(error_set, COL_TRAVERSE_DEFAULT);
- col_destroy_collection(error_set);
+ free_ini_config_errors(error_set);
printf("Negtive test - trying to get non existing key-value pair.\n");
@@ -289,14 +289,14 @@ int get_test()
error = get_config_item("monitor1", "description1", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should not be found */
if (item != (struct collection_item *)(NULL)) {
printf("Expected NULL but got something else!\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -305,14 +305,14 @@ int get_test()
error = get_config_item("monitor", "description1", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should not be found */
if(item != (struct collection_item *)(NULL)) {
printf("Expected NULL but got something else!\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -323,14 +323,14 @@ int get_test()
error = get_config_item("monitor", "description", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected item but got something NULL!\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -343,7 +343,7 @@ int get_test()
cstrn = get_const_string_config_value(NULL, NULL);
if (cstrn != NULL) {
printf("Expected error got success.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -354,7 +354,7 @@ int get_test()
cstr = get_const_string_config_value(item, &error);
if (error) {
printf("Expected success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -368,7 +368,7 @@ int get_test()
str = get_string_config_value(item, &error);
if (error) {
printf("Expected success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -383,14 +383,14 @@ int get_test()
error = get_config_item("monitor", "bad_number", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected item but got something NULL!\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -405,7 +405,7 @@ int get_test()
printf("Expected error.\n");
if(number != 10) {
printf("It failed to set default value.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
}
@@ -418,14 +418,14 @@ int get_test()
if (error) {
/* We expected error in this case */
printf("Did not expect error.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
if (number != 5) {
/* We expected error in this case */
printf("We expected that the conversion will return 5.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -437,14 +437,14 @@ int get_test()
error = get_config_item("domains/LOCAL","enumerate", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -455,14 +455,14 @@ int get_test()
number = get_int_config_value(item, 1, 100, &error);
if (error) {
printf("Did not expect error. Got %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* It is 3 in the file */
if (number != 3) {
printf("We expected that the conversion will return 3.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -475,14 +475,14 @@ int get_test()
number_long = get_long_config_value(item, 1, 100, &error);
if (error) {
printf("Did not expect error. Got %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* It is 3 in the file */
if (number_long != 3) {
printf("We expected that the conversion will return 3.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -495,14 +495,14 @@ int get_test()
number_unsigned = get_unsigned_config_value(item, 1, 100, &error);
if (error) {
printf("Did not expect error. Got %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* It is 3 in the file */
if(number_unsigned != 3) {
printf("We expected that the conversion will return 3.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -515,14 +515,14 @@ int get_test()
number_ulong = get_ulong_config_value(item, 1, 100, &error);
if (error) {
printf("Did not expect error. Got %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* It is 3 in the file */
if (number_ulong != 3) {
printf("We expected that the conversion will return 3.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -535,14 +535,14 @@ int get_test()
number_double = get_double_config_value(item, 1, 100., &error);
if (error) {
printf("Did not expect error. Got %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* It is 3 in the file */
if (number_double != 3.) {
printf("We expected that the conversion will return 3.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -555,7 +555,7 @@ int get_test()
logical = get_bool_config_value(item, 1, &error);
if (!error) {
printf("Expect error. Got success.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -566,14 +566,14 @@ int get_test()
error = get_config_item("domains/LOCAL","legacy", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n",error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -583,7 +583,7 @@ int get_test()
logical = get_bool_config_value(item, 1, &error);
if (error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -600,14 +600,14 @@ int get_test()
error = get_config_item("domains/EXAMPLE.COM","binary_test", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -617,7 +617,7 @@ int get_test()
binary = get_bin_config_value(item, &length, &error);
if (error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -635,14 +635,14 @@ int get_test()
error = get_config_item("domains", "domainsorder", ini_config, &item);
if(error) {
printf("Expected success but got error! %d\n",error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -654,7 +654,7 @@ int get_test()
strarray = get_string_config_array(item, ",", NULL, &error);
if (error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -674,7 +674,7 @@ int get_test()
strarray = get_string_config_array(item, ",", &size, &error);
if (error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -689,14 +689,14 @@ int get_test()
error = get_config_item("domains/EXAMPLE.COM", "long_array", ini_config, &item);
if(error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -707,7 +707,7 @@ int get_test()
array = get_long_config_array(item, &size, &error);
if(error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -722,14 +722,14 @@ int get_test()
error = get_config_item("domains/EXAMPLE.COM", "double_array", ini_config, &item);
if (error) {
printf("Expected success but got error! %d\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
/* Item should be found */
if (item == (struct collection_item *)(NULL)) {
printf("Expected success but got NULL.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -740,7 +740,7 @@ int get_test()
darray = get_double_config_array(item, &size, &error);
if (error) {
printf("Expect success got error %d.\n", error);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return error;
}
@@ -755,7 +755,7 @@ int get_test()
prop_array = get_section_list(ini_config, NULL, NULL);
if (prop_array == NULL) {
printf("Expect success got error.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -772,7 +772,7 @@ int get_test()
prop_array = get_section_list(ini_config, &size, NULL);
if (prop_array == NULL) {
printf("Expect success got error.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
@@ -785,14 +785,14 @@ int get_test()
prop_array = get_attribute_list(ini_config, "domains/EXAMPLE.COM", &size, &error);
if (prop_array == NULL) {
printf("Expect success got error.\n");
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
return -1;
}
for (i=0;i<size;i++) printf("Attribute: [%s]\n", prop_array[i]);
free_attribute_list(prop_array);
- col_destroy_collection(ini_config);
+ free_ini_config(ini_config);
printf("Done with get test!\n");
return EOK;
}