Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 41610 invoked from network); 14 Oct 2005 01:55:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Oct 2005 01:55:37 -0000 Received: (qmail 36516 invoked by uid 500); 14 Oct 2005 01:55:36 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 36466 invoked by uid 500); 14 Oct 2005 01:55:34 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 36455 invoked by uid 500); 14 Oct 2005 01:55:33 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 36452 invoked by uid 99); 14 Oct 2005 01:55:33 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 13 Oct 2005 18:55:33 -0700 Received: (qmail 40446 invoked by uid 65534); 14 Oct 2005 01:55:12 -0000 Message-ID: <20051014015512.40436.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r320967 - in /webservices/axis2/trunk/c/modules: test/common/ test/unit/ test/util/ util/src/ util/test/ Date: Fri, 14 Oct 2005 01:55:10 -0000 To: axis2-cvs@ws.apache.org From: damitha@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: damitha Date: Thu Oct 13 18:54:55 2005 New Revision: 320967 URL: http://svn.apache.org/viewcvs?rev=320967&view=rev Log: Added system test for hash. Also updated the build files Modified: webservices/axis2/trunk/c/modules/test/common/test_common.c webservices/axis2/trunk/c/modules/test/unit/Makefile.am webservices/axis2/trunk/c/modules/test/unit/Makefile.in webservices/axis2/trunk/c/modules/test/util/test_util.c webservices/axis2/trunk/c/modules/util/src/Makefile.am webservices/axis2/trunk/c/modules/util/src/axis2_stream.c webservices/axis2/trunk/c/modules/util/test/util_hash_test.c webservices/axis2/trunk/c/modules/util/test/util_hash_test.h webservices/axis2/trunk/c/modules/util/test/util_log_test.c webservices/axis2/trunk/c/modules/util/test/util_log_test.h webservices/axis2/trunk/c/modules/util/test/util_stream_test.c webservices/axis2/trunk/c/modules/util/test/util_stream_test.h Modified: webservices/axis2/trunk/c/modules/test/common/test_common.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/common/test_common.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/test/common/test_common.c (original) +++ webservices/axis2/trunk/c/modules/test/common/test_common.c Thu Oct 13 18:54:55 2005 @@ -3,4 +3,5 @@ int main() { + return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/modules/test/unit/Makefile.am URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/unit/Makefile.am?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/test/unit/Makefile.am (original) +++ webservices/axis2/trunk/c/modules/test/unit/Makefile.am Thu Oct 13 18:54:55 2005 @@ -3,5 +3,5 @@ AM_CPPFLAGS = $(CPPFLAGS) unit_test_SOURCES = main.c -unit_test_LDADD = $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libutil_test.la ../../common/src/libcommon.la ../../util/src/libutil.la -ldl +unit_test_LDADD = $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libtest_util.la ../../common/src/libcommon.la ../../util/src/libutil.la -ldl INCLUDES = -I${CUTEST_HOME}/include -I../../../include Modified: webservices/axis2/trunk/c/modules/test/unit/Makefile.in URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/unit/Makefile.in?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/test/unit/Makefile.in (original) +++ webservices/axis2/trunk/c/modules/test/unit/Makefile.in Thu Oct 13 18:54:55 2005 @@ -55,8 +55,8 @@ unit_test_OBJECTS = $(am_unit_test_OBJECTS) am__DEPENDENCIES_1 = unit_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - ../../common/test/libcommon_test.la \ - ../../util/test/libutil_test.la ../../common/src/libcommon.la \ + ../../common/test/libtest_common.la \ + ../../util/test/libtest_util.la ../../common/src/libcommon.la \ ../../util/src/libutil.la DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp @@ -180,7 +180,7 @@ SUBDIRS = AM_CPPFLAGS = $(CPPFLAGS) unit_test_SOURCES = main.c -unit_test_LDADD = $(LDFLAGS) ../../common/test/libcommon_test.la ../../util/test/libutil_test.la ../../common/src/libcommon.la ../../util/src/libutil.la -ldl +unit_test_LDADD = $(LDFLAGS) ../../common/test/libtest_common.la ../../util/test/libtest_util.la ../../common/src/libcommon.la ../../util/src/libutil.la -ldl INCLUDES = -I${CUTEST_HOME}/include -I../../../include all: all-recursive Modified: webservices/axis2/trunk/c/modules/test/util/test_util.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/util/test_util.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/test/util/test_util.c (original) +++ webservices/axis2/trunk/c/modules/test/util/test_util.c Thu Oct 13 18:54:55 2005 @@ -1,4 +1,91 @@ -int main(void) +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +typedef struct a +{ + char *value; +} a; + + + +int test_hash_get () { + axis2_allocator_t *allocator = axis2_allocator_init (NULL); + axis2_string_t *string = axis2_allocator_init (NULL); + axis2_environment_t *environment = + axis2_environment_create (allocator, NULL, NULL, NULL, string); + + axis2_hash_t *ht; + a *a1, *a2, *a3, *a4; + + axis2_hash_index_t *i = 0; + void *v = NULL; + + char *key1 = "key1"; + char *key2 = "key2"; + char *key3 = "key3"; + char *key4 = "key4"; + + a1 = (a *) axis2_malloc(environment->allocator, sizeof (a)); + a2 = (a *) axis2_malloc(environment->allocator, sizeof (a)); + a3 = (a *) axis2_malloc(environment->allocator, sizeof (a)); + a4 = (a *) axis2_malloc(environment->allocator, sizeof (a)); + + + a1->value = axis2_strdup(environment->string, "value1"); + a2->value = axis2_strdup(environment->string, "value2"); + a3->value = axis2_strdup(environment->string, "value3"); + a4->value = axis2_strdup(environment->string, "value4"); + + + ht = axis2_hash_make (environment); + + axis2_hash_set (ht, key1, AXIS2_HASH_KEY_STRING, a1); + axis2_hash_set (ht, key2, AXIS2_HASH_KEY_STRING, a2); + axis2_hash_set (ht, key3, AXIS2_HASH_KEY_STRING, a3); + axis2_hash_set (ht, key4, AXIS2_HASH_KEY_STRING, a4); + + for (i = axis2_hash_first (environment, ht); i; i = axis2_hash_next (i)) + { + + axis2_hash_this (i, NULL, NULL, &v); + + printf ("\n %s \n", ((a *) v)->value); + } + + printf ("\n demo get %s ", + ((a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING))->value); + + printf ("\n demo get %s ", + ((a *) axis2_hash_get (ht, key2, AXIS2_HASH_KEY_STRING))->value); + + printf ("\n demo get %s ", + ((a *) axis2_hash_get (ht, key3, AXIS2_HASH_KEY_STRING))->value); + + printf ("\n demo get %s \n", + ((a *) axis2_hash_get (ht, key4, AXIS2_HASH_KEY_STRING))->value); + return 0; +} + +int main(void) +{ + test_hash_get(); } Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.am URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.am?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/src/Makefile.am (original) +++ webservices/axis2/trunk/c/modules/util/src/Makefile.am Thu Oct 13 18:54:55 2005 @@ -1,6 +1,12 @@ lib_LTLIBRARIES = libutil.la AM_CPPFLAGS = $(CPPFLAGS) -libutil_la_SOURCES = axis2_hash.c axis2_allocator.c axis2_environment.c axis2_error.c axis2_stream.c axis2_log.c +libutil_la_SOURCES = axis2_hash.c \ + axis2_allocator.c \ + axis2_environment.c \ + axis2_error.c \ + axis2_stream.c \ + axis2_log.c \ + axis2_string.c libutil_la_LIBADD = $(LDFLAGS) INCLUDES = -I../../../include -I${CUTEST_HOME}/include Modified: webservices/axis2/trunk/c/modules/util/src/axis2_stream.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_stream.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/src/axis2_stream.c (original) +++ webservices/axis2/trunk/c/modules/util/src/axis2_stream.c Thu Oct 13 18:54:55 2005 @@ -72,4 +72,3 @@ printf("%c", ((axis2_char_t*)buffer)[i]); return 0; } - Modified: webservices/axis2/trunk/c/modules/util/test/util_hash_test.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_hash_test.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_hash_test.c (original) +++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.c Thu Oct 13 18:54:55 2005 @@ -6,10 +6,11 @@ } a; void Testaxis2_hash_ops_get(CuTest *tc) -{ +{ + axis2_string_t *string = axis2_allocator_init (NULL); axis2_allocator_t *allocator = axis2_allocator_init (NULL); axis2_environment_t *environment = - axis2_environment_create (allocator, NULL, NULL, NULL); + axis2_environment_create (allocator, NULL, NULL, NULL, string); axis2_hash_t *ht; a *actual, *expected; @@ -22,7 +23,7 @@ actual = (a *) axis2_malloc(environment->allocator, sizeof (a)); - actual->value = axis2_strdup(environment->allocator, "value1"); + actual->value = axis2_strdup(environment->string, "value1"); ht = axis2_hash_make (environment); @@ -39,4 +40,3 @@ expected = (a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING); CuAssertStrEquals(tc, expected->value, actual->value); } - Modified: webservices/axis2/trunk/c/modules/util/test/util_hash_test.h URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_hash_test.h?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_hash_test.h (original) +++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.h Thu Oct 13 18:54:55 2005 @@ -7,6 +7,7 @@ #include #include #include +#include void Testaxis2_hash_ops_get(CuTest *tc); Modified: webservices/axis2/trunk/c/modules/util/test/util_log_test.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_log_test.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_log_test.c (original) +++ webservices/axis2/trunk/c/modules/util/test/util_log_test.c Thu Oct 13 18:54:55 2005 @@ -5,10 +5,9 @@ char actual[10]; axis2_allocator_t *allocator = axis2_allocator_init(NULL); - axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL); + axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL); axis2_stream_read(env->stream, actual, 10); axis2_log_write(env->log, actual, 10); char *expected = strdup("aaaaaaaaa"); CuAssertStrEquals(tc, expected, actual); } - Modified: webservices/axis2/trunk/c/modules/util/test/util_log_test.h URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_log_test.h?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_log_test.h (original) +++ webservices/axis2/trunk/c/modules/util/test/util_log_test.h Thu Oct 13 18:54:55 2005 @@ -6,6 +6,7 @@ #include #include #include +#include void Testaxis2_log_ops_write(CuTest *tc); Modified: webservices/axis2/trunk/c/modules/util/test/util_stream_test.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_stream_test.c?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_stream_test.c (original) +++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.c Thu Oct 13 18:54:55 2005 @@ -4,7 +4,7 @@ char actual[10]; axis2_allocator_t *allocator = axis2_allocator_init(NULL); - axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL); + axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL); axis2_stream_read(env->stream, actual, 10); char *expected = strdup("aaaaaaaaa"); CuAssertStrEquals(tc, expected, actual); @@ -14,7 +14,7 @@ char actual[10]; axis2_allocator_t *allocator = axis2_allocator_init(NULL); - axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL); + axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL, NULL); axis2_stream_read(env->stream, actual, 10); axis2_stream_write(env->stream, actual, 10); char *expected = strdup("aaaaaaaaa"); Modified: webservices/axis2/trunk/c/modules/util/test/util_stream_test.h URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_stream_test.h?rev=320967&r1=320966&r2=320967&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/test/util_stream_test.h (original) +++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.h Thu Oct 13 18:54:55 2005 @@ -6,6 +6,7 @@ #include #include #include +#include void Testaxis2_stream_ops_read(CuTest *tc);