diff options
author | gmcdonald | 2010-02-13 01:32:03 +0000 |
---|---|---|
committer | gmcdonald | 2010-02-13 01:32:03 +0000 |
commit | 0425aadc78680e53000fd0108b540d6eca048516 (patch) | |
tree | 8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /util/test/link_list | |
download | axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2 |
Moving axis svn, part of TLP move INFRA-2441
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util/test/link_list')
-rw-r--r-- | util/test/link_list/Makefile.am | 13 | ||||
-rw-r--r-- | util/test/link_list/build.sh | 3 | ||||
-rw-r--r-- | util/test/link_list/link_list_test.c | 69 |
3 files changed, 85 insertions, 0 deletions
diff --git a/util/test/link_list/Makefile.am b/util/test/link_list/Makefile.am new file mode 100644 index 0000000..409d710 --- /dev/null +++ b/util/test/link_list/Makefile.am @@ -0,0 +1,13 @@ +TESTS = link_list_test +check_PROGRAMS = link_list_test +noinst_PROGRAMS = link_list_test +link_list_test_SOURCES = link_list_test.c ../util/create_env.c + +link_list_test_LDADD = \ + $(top_builddir)/src/libaxutil.la + +INCLUDES = -I$(top_builddir)/include \ + -I ../../../axiom/include \ + -I ../../../include + + diff --git a/util/test/link_list/build.sh b/util/test/link_list/build.sh new file mode 100644 index 0000000..154b0d3 --- /dev/null +++ b/util/test/link_list/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gcc link_list_test.c ../util/create_env.c -g -I$AXIS2C_HOME/include/axis2-1.3.0 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o link_list_test diff --git a/util/test/link_list/link_list_test.c b/util/test/link_list/link_list_test.c new file mode 100644 index 0000000..c32f360 --- /dev/null +++ b/util/test/link_list/link_list_test.c @@ -0,0 +1,69 @@ +#include <axutil_linked_list.h> +#include "../util/create_env.h" + +axutil_env_t *env = NULL; +axutil_linked_list_t * linked_list = NULL; +entry_t *entry = NULL; + +axis2_status_t test_link_list(axutil_env_t *env,char * first_item,char * second_item,char * third_item,char *last_item,char *array) +{ + linked_list = axutil_linked_list_create(env); + if(linked_list) + { + printf("link list is created \n"); + } + if(!linked_list) + { + printf("link list is not created "); + } + axutil_linked_list_add_first(linked_list,env,(void *)first_item); + axutil_linked_list_contains(linked_list,env,(void *)second_item); + axutil_linked_list_add(linked_list,env,(void *)third_item); + axutil_linked_list_add_last(linked_list,env,(void *)last_item); + int index_of_item = axutil_linked_list_index_of(linked_list,env,third_item); + printf("The index of item is %d\n",index_of_item); + int index_of_last_item = axutil_linked_list_last_index_of(linked_list,env,last_item); + entry_t * entry = axutil_linked_list_get_entry(linked_list,env,0); + printf("The index of last item is %d\n",index_of_last_item); + void *get_item = axutil_linked_list_get(linked_list,env,1); + printf("The get item is %s\n",(char *)get_item); + axutil_linked_list_set(linked_list,env,1,(void *)array); + axutil_linked_list_to_array(linked_list,env); + axutil_linked_list_add_at_index(linked_list,env,1,(void *)second_item); + axutil_linked_list_remove_at_index(linked_list,env,1); + axutil_linked_list_check_bounds_inclusive(linked_list,env,1); + axutil_linked_list_remove_entry(linked_list,env,entry); + axutil_linked_list_remove_first(linked_list,env); + axutil_linked_list_remove_last(linked_list,env); + axutil_linked_list_remove(linked_list,env,(void *)third_item); + axutil_linked_list_free(linked_list,env); + if(index_of_item && index_of_last_item && get_item) + { + printf("The test is SUCCESS\n"); + } + if(!index_of_item || !index_of_last_item || !get_item) + { + printf("The test is FAIL\n"); + } + return AXIS2_SUCCESS; +} + +int main() +{ + int status = AXIS2_SUCCESS; + env = create_environment(); + status = test_link_list(env,"first entry","secnd entry","third entry","last entry" ,"test"); + if(status == AXIS2_FAILURE) + { + printf(" build failed"); + } + axutil_env_free(env); + return 0; +} + + + + + + + |