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/string_util | |
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/string_util')
-rw-r--r-- | util/test/string_util/Makefile.am | 13 | ||||
-rw-r--r-- | util/test/string_util/build.sh | 3 | ||||
-rw-r--r-- | util/test/string_util/string_util_test.c | 66 |
3 files changed, 82 insertions, 0 deletions
diff --git a/util/test/string_util/Makefile.am b/util/test/string_util/Makefile.am new file mode 100644 index 0000000..09ce78f --- /dev/null +++ b/util/test/string_util/Makefile.am @@ -0,0 +1,13 @@ +TESTS = string_util_test +noinst_PROGRAMS = string_util_test +check_PROGRAMS = string_util_test +string_util_test_SOURCES = string_util_test.c ../util/create_env.c + +string_util_test_LDADD = \ + $(top_builddir)/src/libaxutil.la + +INCLUDES = -I$(top_builddir)/include \ + -I ../../../axiom/include \ + -I ../../../include + + diff --git a/util/test/string_util/build.sh b/util/test/string_util/build.sh new file mode 100644 index 0000000..504ca27 --- /dev/null +++ b/util/test/string_util/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gcc string_util_test.c ../util/create_env.c -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -o string_util_test diff --git a/util/test/string_util/string_util_test.c b/util/test/string_util/string_util_test.c new file mode 100644 index 0000000..d9e0cb2 --- /dev/null +++ b/util/test/string_util/string_util_test.c @@ -0,0 +1,66 @@ +#include <string.h> +#include "../util/create_env.h" +#include <axutil_string_util.h> +#include <axutil_array_list.h> + +/** @brief test string + * tokenize a string + */ + +axis2_status_t test_string(axutil_env_t *env) +{ + int delim = ' '; + void *token = NULL; + void *last_token_string = NULL; + void *first_token_string = NULL; + axutil_array_list_t * first_token, * last_token; + axis2_char_t * in = "this is a test string"; + + axutil_array_list_t * tokenize = axutil_tokenize(env, in, delim); + if(tokenize) + { + token = axutil_array_list_get(tokenize,env,4); + printf("The test axutil_tokenize is successfull\n"); + printf("The tokenize string is %s\n",(char *)token); + } + else + return AXIS2_FAILURE; + + first_token = axutil_first_token(env,in,delim); + if(first_token) + { + first_token_string = axutil_array_list_get(first_token,env,1); + printf("The test axutil_first_token is successfull\n"); + printf("First token string is %s\n",(char *)first_token_string); + } + else + return AXIS2_FAILURE; + + last_token = axutil_last_token(env,in,delim); + if(last_token) + { + last_token_string = axutil_array_list_get(last_token,env,1); + printf("The test axutil_last_token is successfull\n"); + printf("Last token string is %s\n",(char *)last_token_string); + } + else + return AXIS2_FAILURE; + + return AXIS2_SUCCESS; +} +int main() +{ + axutil_env_t *env = NULL; + int status = AXIS2_SUCCESS; + env = create_environment(); + status = test_string(env); + if(status == AXIS2_FAILURE) + { + printf("build failed"); + } + axutil_env_free(env); + return 0; +} + + + |