From 0425aadc78680e53000fd0108b540d6eca048516 Mon Sep 17 00:00:00 2001 From: gmcdonald Date: Sat, 13 Feb 2010 01:32:03 +0000 Subject: 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 --- util/test/string_util/Makefile.am | 13 +++++++ util/test/string_util/build.sh | 3 ++ util/test/string_util/string_util_test.c | 66 ++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 util/test/string_util/Makefile.am create mode 100644 util/test/string_util/build.sh create mode 100644 util/test/string_util/string_util_test.c (limited to 'util/test/string_util') 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 +#include "../util/create_env.h" +#include +#include + +/** @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; +} + + + -- cgit v1.1-32-gdbae