diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-04-10 11:30:59 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-04-10 16:59:24 -0400 |
commit | 15221b649ccff0a7b70592b604c8bdef905afd76 (patch) | |
tree | f7b5ee74fba4bfcef7db19220be5e6fbe3583b6b /ini/ini_config_ut.c | |
parent | 7a4629f520bb3da6e349909f90489cac16745b0e (diff) | |
download | ding-libs-15221b649ccff0a7b70592b604c8bdef905afd76.tar.gz ding-libs-15221b649ccff0a7b70592b604c8bdef905afd76.tar.xz ding-libs-15221b649ccff0a7b70592b604c8bdef905afd76.zip |
Added functions to create list of sections and attributes.
Diffstat (limited to 'ini/ini_config_ut.c')
-rw-r--r-- | ini/ini_config_ut.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ini/ini_config_ut.c b/ini/ini_config_ut.c index 4968a0a..28560e5 100644 --- a/ini/ini_config_ut.c +++ b/ini/ini_config_ut.c @@ -227,6 +227,7 @@ int get_test() int size; long *array; double *darray; + char **prop_array; printf("\n\n===== GET TEST START ======\n"); printf("Reading collection\n"); @@ -712,6 +713,49 @@ int get_test() free_double_config_array(darray); + printf("\n\nSection list - no size\n"); + + /* Do not care about the error or size */ + prop_array = get_section_list(ini_config,NULL,NULL); + if (prop_array == NULL) { + printf("Expect success got error.\n"); + destroy_collection(ini_config); + return -1; + } + + i = 0; + while (prop_array[i]) { + printf("Section: [%s]\n", prop_array[i]); + i++; + } + free_section_list(prop_array); + + printf("\n\nSection list - with size\n"); + + /* Do not care about the error or size */ + prop_array = get_section_list(ini_config, &size, NULL); + if (prop_array == NULL) { + printf("Expect success got error.\n"); + destroy_collection(ini_config); + return -1; + } + + for (i=0;i<size;i++) printf("Section: [%s]\n", prop_array[i]); + free_section_list(prop_array); + + printf("\n\nAttributes in the section - with size and error\n"); + + /* Do not care about the error or size */ + prop_array = get_attribute_list(ini_config, "domains/EXAMPLE.COM", &size, &error); + if (prop_array == NULL) { + printf("Expect success got error.\n"); + destroy_collection(ini_config); + return -1; + } + + for (i=0;i<size;i++) printf("Section: [%s]\n", prop_array[i]); + free_attribute_list(prop_array); + printf("Done with get test!\n"); return EOK; } |