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/stack | |
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/stack')
-rw-r--r-- | util/test/stack/Makefile.am | 13 | ||||
-rw-r--r-- | util/test/stack/build.sh | 3 | ||||
-rw-r--r-- | util/test/stack/stack_test.c | 71 |
3 files changed, 87 insertions, 0 deletions
diff --git a/util/test/stack/Makefile.am b/util/test/stack/Makefile.am new file mode 100644 index 0000000..10308c8 --- /dev/null +++ b/util/test/stack/Makefile.am @@ -0,0 +1,13 @@ +TESTS = stack_test +check_PROGRAMS = stack_test +noinst_PROGRAMS = stack_test +stack_test_SOURCES = stack_test.c ../util/create_env.c + +stack_test_LDADD = \ + $(top_builddir)/src/libaxutil.la + +INCLUDES = -I$(top_builddir)/include \ + -I ../../../axiom/include \ + -I ../../../include + + diff --git a/util/test/stack/build.sh b/util/test/stack/build.sh new file mode 100644 index 0000000..8ca7aff --- /dev/null +++ b/util/test/stack/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gcc stack_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 stack_test -ldl -Wl,--rpath -Wl,$AXIS2C_HOME/lib diff --git a/util/test/stack/stack_test.c b/util/test/stack/stack_test.c new file mode 100644 index 0000000..833adc2 --- /dev/null +++ b/util/test/stack/stack_test.c @@ -0,0 +1,71 @@ +#include "../util/create_env.h" +#include <axutil_stack.h> + +axis2_status_t test_stack(axutil_env_t * env, char * value) +{ + axutil_stack_t * stack = NULL; + axis2_status_t status = AXIS2_FAILURE; + stack = axutil_stack_create(env); + void * get_value = NULL; + if (!stack) + { + printf("Creation of stack failed"); + return AXIS2_FAILURE; + } + status = axutil_stack_push(stack,env,(void *)value); + if (status != AXIS2_SUCCESS) + { + printf("Adding value to stack failed"); + axutil_stack_free(stack,env); + return AXIS2_FAILURE; + } + if (axutil_stack_size(stack,env) != 1) + { + printf("Incorrect size of stack is reported"); + axutil_stack_free(stack,env); + return AXIS2_FAILURE; + } + if (value != (char *)axutil_stack_get(stack,env)) + { + printf("Stack returns incorrect object"); + axutil_stack_free(stack,env); + return AXIS2_FAILURE; + } + get_value = axutil_stack_get_at(stack,env,0); + printf("The value of stack is %s",(char *)get_value); + if (value != (char *)axutil_stack_pop(stack,env)) + { + printf("Stack returns incorrect object"); + axutil_stack_free(stack,env); + return AXIS2_FAILURE; + } + if (axutil_stack_size(stack,env) != 0) + { + printf("Incorrect size of stack is reported"); + axutil_stack_free(stack,env); + return AXIS2_FAILURE; + } + if(stack) + { + axutil_stack_free(stack,env); + printf("The test is SUCCESSFUL\n"); + return AXIS2_SUCCESS; + } + + return AXIS2_FAILURE; +} +int main() +{ + char value[10] = "test\n"; + int status = AXIS2_SUCCESS; + axutil_env_t *env = NULL; + env = create_environment(); + status = test_stack(env,value); + if(status != AXIS2_SUCCESS) + { + printf("The test failed"); + } + axutil_env_free(env); + return 0; +} + |