From c8d5aeb5d3048e8a037f1884b59cef8adf7e25b2 Mon Sep 17 00:00:00 2001 From: damitha Date: Thu, 8 Jul 2010 06:38:10 +0000 Subject: Added the simple test suite suggested in AXIS2C-1412 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@961590 13f79535-47bb-0310-9956-ffa450edef68 --- util/test/utils/Makefile.am | 4 +++- util/test/utils/utils_test.c | 36 +++++++++++++----------------------- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'util/test/utils') diff --git a/util/test/utils/Makefile.am b/util/test/utils/Makefile.am index 0fbcc8d..99d3dc3 100644 --- a/util/test/utils/Makefile.am +++ b/util/test/utils/Makefile.am @@ -7,7 +7,9 @@ utils_test_LDADD = \ $(top_builddir)/src/libaxutil.la INCLUDES = -I$(top_builddir)/include \ + -I$(CUTEST_HOME)/include \ -I ../../../axiom/include \ - -I ../../../include + -I ../../../include \ + -I ../../../cutest/include diff --git a/util/test/utils/utils_test.c b/util/test/utils/utils_test.c index 2bbf67f..d75a4cd 100644 --- a/util/test/utils/utils_test.c +++ b/util/test/utils/utils_test.c @@ -1,45 +1,35 @@ #include "../util/create_env.h" #include +#include -axutil_env_t *env = NULL; -axis2_char_t * request = "This is a requset"; -axis2_char_t * s = "This is a & '""xml string"; +axis2_char_t * request = "This is a request"; +axis2_char_t * s = "This is a & in xml string"; axis2_char_t c = 'c'; /** @brief test utils * test quote string */ -axis2_status_t test_utils() +void test_utils(axutil_env_t *env) { axis2_char_t **op, *quote_string; int hexit; - env = create_environment(); op = axutil_parse_request_url_for_svc_and_op(env,request); + CUT_ASSERT_PTR_NOT_EQUAL(op, NULL, 0); quote_string = axutil_xml_quote_string(env,s,1); - printf("The quote string is%s\n",(char *)quote_string); + CUT_ASSERT_STR_EQUAL(quote_string, "<root>This is a & in xml string</root>", 0); hexit = axutil_hexit(c); - printf("%d\n",hexit); - if(op && quote_string) - { - printf("The test is SUCCESS\n"); - } - if(!op || !quote_string) - { - printf("The test is FAIL"); - } - return AXIS2_SUCCESS; + CUT_ASSERT_INT_EQUAL(hexit,12, 0); } int main() { - int status = AXIS2_SUCCESS; - env = create_environment(); - status = test_utils(); - if(status == AXIS2_FAILURE) - { - printf(" test failed"); + axutil_env_t *env = cut_setup_env("util"); + CUT_ASSERT(env != NULL); + if (env) { + test_utils(env); + axutil_env_free(env); } - axutil_env_free(env); + CUT_RETURN_ON_FAILURE(-1); return 0; } -- cgit v1.1-32-gdbae