summaryrefslogtreecommitdiffstats
path: root/util/test/util
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/util
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/util')
-rw-r--r--util/test/util/Makefile.am6
-rw-r--r--util/test/util/test_log.c16
-rw-r--r--util/test/util/test_log.h2
-rw-r--r--util/test/util/test_md5.c2
-rw-r--r--util/test/util/test_string.c17
-rw-r--r--util/test/util/test_thread.c196
-rw-r--r--util/test/util/test_thread.h1
-rw-r--r--util/test/util/test_util.c145
8 files changed, 111 insertions, 274 deletions
diff --git a/util/test/util/Makefile.am b/util/test/util/Makefile.am
index 201ab25..079e1f5 100644
--- a/util/test/util/Makefile.am
+++ b/util/test/util/Makefile.am
@@ -6,11 +6,13 @@ noinst_HEADERS = test_log.h \
test_md5.h
check_PROGRAMS = test_util test_thread
SUBDIRS =
-test_util_SOURCES = test_util.c test_log.c test_string.c test_md5.c
+test_util_SOURCES = test_util.c test_log.c test_md5.c create_env.c
test_thread_SOURCES = test_thread.c
test_util_LDADD = $(top_builddir)/src/libaxutil.la
test_thread_LDADD = $(top_builddir)/src/libaxutil.la
-INCLUDES = -I$(top_builddir)/include
+INCLUDES = -I$(top_builddir)/include \
+ -I$(CUTEST_HOME)/include \
+ -I ../../../cutest/include
diff --git a/util/test/util/test_log.c b/util/test/util/test_log.c
index 4539b4e..195b756 100644
--- a/util/test/util/test_log.c
+++ b/util/test/util/test_log.c
@@ -21,26 +21,30 @@
#include <axutil_log.h>
#include <axutil_log_default.h>
#include <axutil_allocator.h>
-#include <test_log.h>
+#include "test_log.h"
#include <string.h>
-const axutil_env_t *
+
+axutil_env_t *
create_env_with_error_log(
)
{
+ axutil_env_t *env = NULL;
+ axutil_log_t *log22 = NULL;
+ axutil_error_t *error = NULL;
axutil_allocator_t *allocator = axutil_allocator_init(NULL);
if (!allocator)
{
printf("allocator is NULL\n");
return NULL;
}
- axutil_error_t *error = axutil_error_create(allocator);
+ error = axutil_error_create(allocator);
if (!error)
{
printf("cannot create error\n");
return NULL;
}
- axutil_log_t *log22 = axutil_log_create(allocator, NULL, NULL);
+ log22 = axutil_log_create(allocator, NULL, NULL);
if (!log22)
{
printf("cannot create log\n");
@@ -51,7 +55,7 @@ create_env_with_error_log(
*/
log22->level = AXIS2_LOG_LEVEL_DEBUG;
/* log22->enabled = 0; */
- const axutil_env_t *env =
+ env =
axutil_env_create_with_error_log(allocator, error, log22);
if (!env)
{
@@ -161,8 +165,8 @@ void
run_test_log(
)
{
- printf("\n####start of run_test_log test suite\n\n");
const axutil_env_t *env = create_env_with_error_log();
+ printf("\n####start of run_test_log test suite\n\n");
if (!env)
return;
test_axutil_log_write(env);
diff --git a/util/test/util/test_log.h b/util/test/util/test_log.h
index d88669e..123df03 100644
--- a/util/test/util/test_log.h
+++ b/util/test/util/test_log.h
@@ -23,7 +23,7 @@
void run_test_log(
);
-const axutil_env_t *create_env_with_error_log(
+axutil_env_t *create_env_with_error_log(
);
void test_axutil_log_write(
const axutil_env_t * env);
diff --git a/util/test/util/test_md5.c b/util/test/util/test_md5.c
index 7c360ce..6defd46 100644
--- a/util/test/util/test_md5.c
+++ b/util/test/util/test_md5.c
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-#include <test_md5.h>
+#include "test_md5.h"
#include <stdio.h>
#include <axutil_string.h>
#include <axutil_md5.h>
diff --git a/util/test/util/test_string.c b/util/test/util/test_string.c
index d4d7bbc..709a96a 100644
--- a/util/test/util/test_string.c
+++ b/util/test/util/test_string.c
@@ -28,10 +28,7 @@ test_strltrim(
axis2_char_t *s = axutil_strdup(env, " abcd efgh ");
axis2_char_t *trimmed = NULL;
trimmed = axutil_strltrim(env, s, " \t\r\n");
- if (0 == axutil_strcmp(trimmed, "abcd efgh "))
- printf("axutil_strltrim successful\n");
- else
- printf("axutil_strltrim failed [%s]\n", trimmed);
+ CUT_ASSERT_STR_EQUAL(trimmed, "abcd efgh ", 0);
if (trimmed)
AXIS2_FREE(env->allocator, trimmed);
if (s)
@@ -42,13 +39,10 @@ void
test_strrtrim(
const axutil_env_t * env)
{
- axis2_char_t *s = axutil_strdup(env, "abcd efgh ");
+ axis2_char_t *s = axutil_strdup(env, " abcd efgh ");
axis2_char_t *trimmed = NULL;
trimmed = axutil_strrtrim(env, s, " \t\r\n");
- if (0 == axutil_strcmp(trimmed, " abcd efgh"))
- printf("axutil_strrtrim successful\n");
- else
- printf("axutil_strrtrim failed [%s]\n", trimmed);
+ CUT_ASSERT_STR_EQUAL(trimmed, " abcd efgh", 0);
if (trimmed)
AXIS2_FREE(env->allocator, trimmed);
if (s)
@@ -62,10 +56,7 @@ test_strtrim(
axis2_char_t *s = axutil_strdup(env, " abcd efgh ");
axis2_char_t *trimmed = NULL;
trimmed = axutil_strtrim(env, s, " \t\r\n");
- if (0 == axutil_strcmp(trimmed, "abcd efgh"))
- printf("axutil_strtrim successful\n");
- else
- printf("axutil_strtrim failed [%s]\n", trimmed);
+ CUT_ASSERT_STR_EQUAL(trimmed, "abcd efgh", 0);
if (trimmed)
AXIS2_FREE(env->allocator, trimmed);
if (s)
diff --git a/util/test/util/test_thread.c b/util/test/util/test_thread.c
index cbdead5..4bddd7f 100644
--- a/util/test/util/test_thread.c
+++ b/util/test/util/test_thread.c
@@ -24,13 +24,14 @@
#include <axutil_allocator.h>
#include <axutil_utils.h>
#include "test_thread.h"
-#include <unistd.h>
+#include <cut_defs.h>
const axutil_env_t *env = NULL;
static axutil_thread_mutex_t *thread_lock = NULL;
static axutil_thread_once_t *control = NULL;
static int x = 0;
static int value = 0;
+static int param_data;
static axutil_thread_t *t1 = NULL;
static axutil_thread_t *t2 = NULL;
@@ -55,19 +56,14 @@ test_thread_init(
allocator = env->allocator;
control = axutil_thread_once_init(allocator);
-
- if (control)
- printf("success - test_thread_init - axutil_thread_once_init \n");
- else
- printf("failure - test_thread_init - axutil_thread_once_init \n");
+ CUT_ASSERT_PTR_NOT_EQUAL(control, NULL, 0);
thread_lock =
axutil_thread_mutex_create(allocator, AXIS2_THREAD_MUTEX_DEFAULT);
+ CUT_ASSERT_PTR_NOT_EQUAL(thread_lock, NULL, 0);
+ /* To avoid warning of not using cut_str_equal */
+ CUT_ASSERT_STR_EQUAL("", "", 0);
- if (thread_lock)
- printf("success - test_thread_init - axutil_thread_mutex_create \n");
- else
- printf("failure - test_thread_init - axutil_thread_mutex_create \n");
}
void *AXIS2_CALL
@@ -75,12 +71,12 @@ test_function(
axutil_thread_t * td,
void *param)
{
- int i;
- i = *((int *) param);
+ int i = *((int *) param);
printf("thread data = %d \n", i);
-
+ param_data = i;
+
axutil_thread_once(control, init_func);
-
+ CUT_ASSERT(value==1);
axutil_thread_mutex_lock(thread_lock);
printf("x = %d \n", ++x);
axutil_thread_mutex_unlock(thread_lock);
@@ -102,38 +98,26 @@ test_axutil_thread_create(
allocator = env->allocator;
i = AXIS2_MALLOC(allocator, sizeof(int));
*i = 5;
+ param_data = -1;
t1 = axutil_thread_create(allocator, NULL, test_function, (void *) i);
+ CUT_ASSERT_PTR_NOT_EQUAL(t1, NULL, 0);
+ AXIS2_SLEEP(1);
+ CUT_ASSERT_INT_EQUAL(param_data, *i, 0);
- if (t1)
- printf("success - test_axutil_thread_create - axutil_thread_create \n");
- else
- printf("failure - test_axutil_thread_create - axutil_thread_create \n");
j = AXIS2_MALLOC(allocator, sizeof(int));
*j = 25;
-
+ param_data = -1;
t2 = axutil_thread_create(allocator, NULL, test_function, (void *) j);
-
- if (t2)
- printf("success - test_axutil_thread_create - axutil_thread_create \n");
- else
- printf("failure - test_axutil_thread_create - axutil_thread_create \n");
+ CUT_ASSERT_PTR_NOT_EQUAL(t2, NULL, 0);
+ AXIS2_SLEEP(1);
+ CUT_ASSERT_INT_EQUAL(param_data, *j, 0);
rv = axutil_thread_join(t1);
-
- if (AXIS2_SUCCESS == rv)
- printf("success - test_axutil_thread_create - axutil_thread_join \n");
- else
- printf
- ("failure - test_thread_init - test_axutil_thread_create - axutil_thread_join \n");
+ CUT_ASSERT_INT_EQUAL(rv, AXIS2_SUCCESS, 0);
rv = axutil_thread_join(t2);
-
- if (AXIS2_SUCCESS == rv)
- printf("success - test_axutil_thread_create - axutil_thread_join \n");
- else
- printf
- ("failure - test_thread_init - test_axutil_thread_create - axutil_thread_join \n");
+ CUT_ASSERT_INT_EQUAL(rv, AXIS2_SUCCESS, 0);
}
@@ -143,8 +127,6 @@ test_function2(
void *param)
{
printf("thread \n");
- /*axutil_thread_exit(td, env->allocator); */
-
return (void *) 1;
}
@@ -158,49 +140,18 @@ test_axutil_thread_detach(
allocator = env->allocator;
attr = axutil_threadattr_create(allocator);
- if (!attr)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
+ CUT_ASSERT_PTR_NOT_EQUAL(attr, NULL, 1);
rv = axutil_threadattr_detach_set(attr, 1);
-
- if (AXIS2_SUCCESS != rv)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
+ CUT_ASSERT_INT_EQUAL(rv, AXIS2_SUCCESS, 1);
t3 = axutil_thread_create(allocator, attr, test_function2, NULL);
-
- if (!t3)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
+ CUT_ASSERT_PTR_NOT_EQUAL(t3, NULL, 1);
/*
* thread is already detached - should return AXIS2_FAILURE
*/
rv = axutil_thread_detach(t3);
-
- if (AXIS2_FAILURE != rv)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
-
- /*
- * thread is already detached - should return AXIS2_FAILURE
- * cannot join detached threads
- */
- /*rv = axutil_thread_join(t3); */
- if (AXIS2_FAILURE != rv)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
- printf("success - test_axutil_thread_detach\n");
-}
+ CUT_ASSERT_INT_EQUAL(rv, AXIS2_FAILURE, 1);
+ }
void
test_axutil_thread_detach2(
@@ -212,63 +163,29 @@ test_axutil_thread_detach2(
allocator = env->allocator;
attr = axutil_threadattr_create(allocator);
- if (!attr)
- {
- printf("failure - test_axutil_thread_detach2\n");
- return;
- }
+ CUT_ASSERT_PTR_NOT_EQUAL(attr, NULL, 1);
t4 = axutil_thread_create(allocator, attr, test_function2, NULL);
-
- if (!t4)
- {
- printf("failure - test_axutil_thread_detach2\n");
- return;
- }
-
+ CUT_ASSERT_PTR_NOT_EQUAL(t4, NULL, 1);
/*
* thread is not detached yet - should return AXIS2_SUCCESS
*/
rv = axutil_thread_detach(t4);
-
- if (AXIS2_SUCCESS != rv)
- {
- printf("failure - test_axutil_thread_detach\n");
- return;
- }
-
- /*
- * thread is already detached - should return AXIS2_FAILURE
- * cannot join detached threads
- */
- /*rv = axutil_thread_join(t4); */
- if (AXIS2_FAILURE != rv)
- {
- printf("failure - test_axutil_thread_detach2\n");
- return;
- }
- printf("success - test_axutil_thread_detach2\n");
+ CUT_ASSERT_INT_EQUAL(rv, AXIS2_SUCCESS, 1);
}
void
check_locks(
)
{
- if (2 == x)
- printf("success - check_locks \n");
- else
- printf("failure - check_locks \n");
-
+ CUT_ASSERT_INT_EQUAL(x, 2, 0);
}
void
check_thread_once(
)
{
- if (1 == value)
- printf("success - check_thread_once \n");
- else
- printf("failure - check_thread_once \n");
+ CUT_ASSERT_INT_EQUAL(value, 1, 0);
}
void
@@ -291,55 +208,16 @@ run_test_thread(
axutil_thread_mutex_destroy(thread_lock);
}
-const axutil_env_t *
-create_env_with_error_log(
- )
-{
- axutil_error_t *error = NULL;
- axutil_log_t *log22 = NULL;
- const axutil_env_t *env = NULL;
- axutil_allocator_t *allocator = axutil_allocator_init(NULL);
- if (!allocator)
- {
- printf("allocator is NULL\n");
- return NULL;
- }
- error = axutil_error_create(allocator);
- if (!error)
- {
- printf("cannot create error\n");
- return NULL;
- }
-
- log22 = axutil_log_create(allocator, NULL, "test123.log");
- if (!log22)
- {
- printf("cannot create log\n");
- return NULL;
- }
- /*
- * allow all types of logs
- */
- log22->level = AXIS2_LOG_LEVEL_DEBUG;
- /* log22->enabled = 0; */
- env = axutil_env_create_with_error_log(allocator, error, log22);
- if (!env)
- {
- printf("cannot create env with error and log\n");
- return NULL;
- }
- return env;
-}
-
int
main(
void)
{
- env = create_env_with_error_log();
-
- if (!env)
- return -1;
- run_test_thread(env);
-
+ axutil_env_t *env = cut_setup_env("util thread");
+ CUT_ASSERT(env != NULL);
+ if (env) {
+ run_test_thread(env);
+ axutil_env_free(env);
+ }
+ CUT_RETURN_ON_FAILURE(-1);
return 0;
}
diff --git a/util/test/util/test_thread.h b/util/test/util/test_thread.h
index 17d4e7b..9ca1aaf 100644
--- a/util/test/util/test_thread.h
+++ b/util/test/util/test_thread.h
@@ -19,6 +19,7 @@
#ifndef TEST_LOG_H
#define TEST_LOG_H
+#include <platforms/axutil_platform_auto_sense.h>
#include <axutil_env.h>
#include <axutil_thread.h>
diff --git a/util/test/util/test_util.c b/util/test/util/test_util.c
index df9649c..aa2c5bb 100644
--- a/util/test/util/test_util.c
+++ b/util/test/util/test_util.c
@@ -27,27 +27,24 @@
#include <axutil_log.h>
#include <axutil_dir_handler.h>
#include <axutil_file.h>
+#include <cut_defs.h>
#include "axutil_log.h"
#include "test_thread.h"
-#include <test_log.h>
-
+#include "test_log.h"
+#include "test_md5.h"
+#include "test_string.c"
+
+extern void
+run_test_string(
+ axutil_env_t * env);
+
typedef struct a
{
axis2_char_t *value;
}
a;
-const axutil_env_t *
-test_init(
- )
-{
- axutil_allocator_t *allocator = axutil_allocator_init(NULL);
- axutil_error_t *error = axutil_error_create(allocator);
- const axutil_env_t *env = axutil_env_create_with_error(allocator, error);
- return env;
-}
-
-int
+void
test_hash_get(
const axutil_env_t * env)
{
@@ -64,15 +61,6 @@ test_hash_get(
char *key2 = "key2";
char *key3 = "key3";
char *key4 = "key4";
- int cnt = 0;
- axis2_char_t ***rettt = NULL;
- axis2_status_t stat = AXIS2_FAILURE;
- stat = axutil_parse_rest_url_for_params(env, "ech{a}tring", "/echoString?text=Hello%20World%21", &cnt, &rettt);
- stat = axutil_parse_rest_url_for_params(env, "{a}ny/mor/sum", "echoStringmany/mor/sum", &cnt, &rettt);
-/* rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}re/{b}?", "/echoString/more/sum/?");
- rettt = axutil_parse_rest_url_for_params(env, "/ech{c}tring{a}more/{b}/", "/echoStringma/nymore/sum?");
- rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}/more/{b}?{c}", "echoString/many/more/sum/");
- rettt = axutil_parse_rest_url_for_params(env, "echoString/{a}/more/{b}/?", "echoString/many/more/sum/?test=");*/
a1 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a));
a2 = (a *) AXIS2_MALLOC(env->allocator, sizeof(a));
@@ -99,17 +87,17 @@ test_hash_get(
printf("\n %s \n", ((a *) v)->value);
}
- printf("\n demo get %s ",
- ((a *) axutil_hash_get(ht, key1, AXIS2_HASH_KEY_STRING))->value);
+ CUT_ASSERT_STR_EQUAL(
+ ((a *) axutil_hash_get(ht, key1, AXIS2_HASH_KEY_STRING))->value, "value1", 0);
- printf("\n demo get %s ",
- ((a *) axutil_hash_get(ht, key2, AXIS2_HASH_KEY_STRING))->value);
+ CUT_ASSERT_STR_EQUAL(
+ ((a *) axutil_hash_get(ht, key2, AXIS2_HASH_KEY_STRING))->value, "value2", 0);
- printf("\n demo get %s ",
- ((a *) axutil_hash_get(ht, key3, AXIS2_HASH_KEY_STRING))->value);
+ CUT_ASSERT_STR_EQUAL(
+ ((a *) axutil_hash_get(ht, key3, AXIS2_HASH_KEY_STRING))->value, "value3", 0);
- printf("\n demo get %s \n",
- ((a *) axutil_hash_get(ht, key4, AXIS2_HASH_KEY_STRING))->value);
+ CUT_ASSERT_STR_EQUAL(
+ ((a *) axutil_hash_get(ht, key4, AXIS2_HASH_KEY_STRING))->value, "value4", 0);
axutil_hash_free(ht, env);
AXIS2_FREE(env->allocator, a1->value);
@@ -120,22 +108,15 @@ test_hash_get(
AXIS2_FREE(env->allocator, a2);
AXIS2_FREE(env->allocator, a3);
AXIS2_FREE(env->allocator, a4);
- return 0;
}
void
-test_axutil_dir_handler_list_service_or_module_dirs(
- )
+test_axutil_dir_handler_list_service_or_module_dirs(axutil_env_t *env)
{
int i,
isize;
axutil_file_t *file = NULL;
axis2_char_t *filename = NULL;
- axutil_allocator_t *allocator = axutil_allocator_init(NULL);
- axutil_error_t *error = axutil_error_create(allocator);
- axutil_log_t *log = axutil_log_create(allocator, NULL, NULL);
- const axutil_env_t *env =
- axutil_env_create_with_error_log(allocator, error, log);
axis2_char_t *pathname = axutil_strdup(env, "/tmp/test/");
@@ -165,13 +146,9 @@ test_axutil_dir_handler_list_service_or_module_dirs(
* This test is intended to test whether given two files are equal or not.
* Spaces and new lines are ignored in comparing
*/
-int
-test_file_diff(
+void test_file_diff(
const axutil_env_t * env)
{
- /* axis2_char_t *expected_file_name = axutil_strdup("expected", env);
- axis2_char_t *actual_file_name = axutil_strdup("actual", env); */
- return 0;
}
void
@@ -183,7 +160,8 @@ test_array_list(
int size;
al = axutil_array_list_create(env, 1);
- printf("list size %d\n", axutil_array_list_size(al, env));
+ CUT_ASSERT_PTR_NOT_EQUAL(al, NULL, 1);
+ CUT_ASSERT_INT_EQUAL(axutil_array_list_size(al, env), 0, 0);
entry = (a *) AXIS2_MALLOC(env->allocator, sizeof(a));
entry->value = axutil_strdup(env, "value1");
@@ -215,13 +193,12 @@ test_array_list(
axutil_array_list_remove(al, env, 2);
entry = (a *) axutil_array_list_get(al, env, 0);
- printf("entry->value:%s\n", entry->value);
+ CUT_ASSERT_STR_EQUAL(entry->value, "value1", 0);
entry = (a *) axutil_array_list_get(al, env, 2);
- printf("entry->value:%s\n", entry->value);
+ CUT_ASSERT_STR_EQUAL(entry->value, "value7", 0);
size = axutil_array_list_size(al, env);
- printf("list size %d\n", axutil_array_list_size(al, env));
-
+ CUT_ASSERT_INT_EQUAL(size, 5, 0);
}
void
@@ -240,46 +217,27 @@ test_uuid_gen(
}
void
-test_log_write(
- )
+test_log_write(void)
{
- char msg[20];
- printf("start of test_log_write\n\n");
+ axutil_error_t *error = NULL;
+ axutil_log_t *log22 = NULL;
+ axutil_env_t *env = NULL;
axutil_allocator_t *allocator = axutil_allocator_init(NULL);
- if (!allocator)
- {
- printf("allocator is NULL\n");
- return;
- }
- axutil_error_t *error = axutil_error_create(allocator);
- if (!error)
- {
- printf("cannot create error\n");
- return;
- }
- axutil_log_t *log22 = axutil_log_create(allocator, NULL, NULL);
- if (!log22)
- {
- printf("cannot create log\n");
- return;
- }
+ CUT_ASSERT_PTR_NOT_EQUAL(allocator, NULL, 1);
+ error = axutil_error_create(allocator);
+ CUT_ASSERT_PTR_NOT_EQUAL(error, NULL, 1);
+ log22 = axutil_log_create(allocator, NULL, NULL);
+ CUT_ASSERT_PTR_NOT_EQUAL(log22, NULL, 1);
log22->level = AXIS2_LOG_LEVEL_DEBUG;
-
- const axutil_env_t *env =
- axutil_env_create_with_error_log(allocator, error, log22);
- if (!env)
- {
- printf("cannot create env with error and log\n");
- return;
- }
- strcpy(msg, "abcd test123");
+ env = axutil_env_create_with_error_log(allocator, error, log22);
+ CUT_ASSERT_PTR_NOT_EQUAL(env, NULL, 1);
AXIS2_LOG_CRITICAL(env->log, AXIS2_LOG_SI, "log1 %s", "test1");
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "log2 %d", 2);
AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "log3 %s", "test3");
AXIS2_LOG_INFO(env->log, AXIS2_LOG_SI, "log4 %s %s", "info1", "info2");
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "log5 %s %d", "test", 5);
- printf("end of test_log_write \n\n");
+ axutil_env_free(env);
}
@@ -287,18 +245,21 @@ int
main(
void)
{
- const axutil_env_t *env = test_init();
- test_hash_get(env);
- test_file_diff(env);
- test_array_list(env);
- test_uuid_gen(env);
- test_md5(env);
- run_test_log();
- run_test_string(env);
- test_axutil_dir_handler_list_service_or_module_dirs();
- axutil_allocator_t *allocator = env->allocator;
-
-/* axutil_env_free(env);*/
- axutil_allocator_free(allocator);
+ axutil_env_t *env = cut_setup_env("util");
+ CUT_ASSERT(env != NULL);
+ if (env)
+ {
+ test_hash_get(env);
+ test_file_diff(env);
+ test_array_list(env);
+ test_uuid_gen(env);
+ test_md5(env);
+ run_test_log();
+ run_test_string(env);
+ test_axutil_dir_handler_list_service_or_module_dirs(env);
+ axutil_env_free(env);
+ }
+ CUT_RETURN_ON_FAILURE(-1);
return 0;
}
+