summaryrefslogtreecommitdiffstats
path: root/util/test/utils
diff options
context:
space:
mode:
authorGravatar damitha2010-07-08 06:38:10 +0000
committerGravatar damitha2010-07-08 06:38:10 +0000
commitc8d5aeb5d3048e8a037f1884b59cef8adf7e25b2 (patch)
tree6edd50a5f63708b4c916614809082d9c1090b262 /util/test/utils
parent4a01960cba446e046d5687279c024fa60b576d85 (diff)
downloadaxis2c-c8d5aeb5d3048e8a037f1884b59cef8adf7e25b2.tar.gz
axis2c-c8d5aeb5d3048e8a037f1884b59cef8adf7e25b2.tar.bz2
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
Diffstat (limited to 'util/test/utils')
-rw-r--r--util/test/utils/Makefile.am4
-rw-r--r--util/test/utils/utils_test.c36
2 files changed, 16 insertions, 24 deletions
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 <axutil_utils.h>
+#include <cut_defs.h>
-axutil_env_t *env = NULL;
-axis2_char_t * request = "This is a requset";
-axis2_char_t * s = "<root>This is a & '""xml string</root>";
+axis2_char_t * request = "This is a request";
+axis2_char_t * s = "<root>This is a & in xml string</root>";
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, "&lt;root&gt;This is a &amp; in xml string&lt;/root&gt;", 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;
}