You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/10/13 08:52:32 UTC

svn commit: r320676 - in /webservices/axis2/trunk/c/modules/util/test: Makefile.am main.c util_error_test.c util_error_test.h util_hash_test.c util_hash_test.h util_log_test.c util_log_test.h util_stream_test.c util_stream_test.h util_test.c util_test.h

Author: damitha
Date: Wed Oct 12 23:52:17 2005
New Revision: 320676

URL: http://svn.apache.org/viewcvs?rev=320676&view=rev
Log:
Updated the main test suite

Added:
    webservices/axis2/trunk/c/modules/util/test/main.c
    webservices/axis2/trunk/c/modules/util/test/util_error_test.c
    webservices/axis2/trunk/c/modules/util/test/util_error_test.h
    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
    webservices/axis2/trunk/c/modules/util/test/util_test.c
    webservices/axis2/trunk/c/modules/util/test/util_test.h
Modified:
    webservices/axis2/trunk/c/modules/util/test/Makefile.am

Modified: webservices/axis2/trunk/c/modules/util/test/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/Makefile.am?rev=320676&r1=320675&r2=320676&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/util/test/Makefile.am Wed Oct 12 23:52:17 2005
@@ -1,7 +1,12 @@
-bin_PROGRAMS = hash_test
+bin_PROGRAMS = util_test
 SUBDIRS =
 AM_CPPFLAGS = $(CPPFLAGS)
-hash_test_SOURCES = hash_test.c
+util_test_SOURCES = main.c 
+util_test_LDADD   =  $(LDFLAGS) libutil_test.la ../src/libutil.la ../../common/src/libcommon.la
 
-hash_test_LDADD   =  $(LDFLAGS) ../src/libutil.la ../../common/src/libcommon.la
+
+noinst_LTLIBRARIES = libutil_test.la
+libutil_test_la_SOURCES = util_stream_test.c util_log_test.c util_error_test.c util_hash_test.c util_test.c
+libutil_test_LIBADD   =  $(LDFLAGS) ../src/libutil.la ../../common/src/libcommon.la
 INCLUDES = -I${CUTEST_HOME}/include -I../../../include
+

Added: webservices/axis2/trunk/c/modules/util/test/main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/main.c?rev=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/main.c (added)
+++ webservices/axis2/trunk/c/modules/util/test/main.c Wed Oct 12 23:52:17 2005
@@ -0,0 +1,18 @@
+#include "util_test.h"
+
+void RunAllTests(void) {
+    CuString *output = CuStringNew();
+    CuSuite* suite = CuSuiteNew();
+
+    CuSuiteAddSuite(suite, axis2_utilGetSuite());
+
+    CuSuiteRun(suite);
+    CuSuiteSummary(suite, output);
+    CuSuiteDetails(suite, output);
+    printf("%s\n", output->buffer);
+}
+
+int main(void) {
+    RunAllTests();
+    return 0;
+}

Added: webservices/axis2/trunk/c/modules/util/test/util_error_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_error_test.c?rev=320676&view=auto
==============================================================================
    (empty)

Added: webservices/axis2/trunk/c/modules/util/test/util_error_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_error_test.h?rev=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_error_test.h (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_error_test.h Wed Oct 12 23:52:17 2005
@@ -0,0 +1,11 @@
+#ifndef UTIL_ERROR_TEST_H
+#define UTIL_ERROR_TEST_H
+
+#include <string.h>
+#include <stdio.h>
+#include <CuTest.h>
+#include <axis2_allocator.h>
+#include <axis2_environment.h>
+
+
+#endif /* UTIL_ERROR_TEST_H*/

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_hash_test.c (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.c Wed Oct 12 23:52:17 2005
@@ -0,0 +1,42 @@
+#include "util_hash_test.h"
+
+typedef struct a
+{
+    char *value;
+} a;
+
+void Testaxis2_hash_ops_get(CuTest *tc)
+{    
+    axis2_allocator_t *allocator = axis2_allocator_init (NULL);
+    axis2_environment_t *environment =
+        axis2_environment_create (allocator, NULL, NULL, NULL);
+
+    axis2_hash_t *ht;
+    a *actual, *expected;
+
+    axis2_hash_index_t *i = 0;
+    void *v = NULL;
+
+    char *key1 = "key1";
+
+    actual = (a *) axis2_malloc(environment->allocator, sizeof (a));
+
+
+    actual->value = axis2_strdup(environment->allocator, "value1");
+
+
+    ht = axis2_hash_make (environment);
+
+    axis2_hash_set (ht, key1, AXIS2_HASH_KEY_STRING, actual);
+
+    for (i = axis2_hash_first (environment, ht); i; i = axis2_hash_next (i))
+    {
+
+        axis2_hash_this (i, NULL, NULL, &v);
+
+    }
+
+    expected = (a *) axis2_hash_get (ht, key1, AXIS2_HASH_KEY_STRING);
+    CuAssertStrEquals(tc, expected->value, actual->value);
+}
+

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_hash_test.h (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_hash_test.h Wed Oct 12 23:52:17 2005
@@ -0,0 +1,13 @@
+#ifndef UTIL_HASH_TEST_H
+#define UTIL_HASH_TEST_H
+
+#include <string.h>
+#include <stdio.h>
+#include <CuTest.h>
+#include <axis2_allocator.h>
+#include <axis2_environment.h>
+#include <axis2_hash.h>
+
+void Testaxis2_hash_ops_get(CuTest *tc);
+
+#endif /* UTIL_HASH_TEST_H*/

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_log_test.c (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_log_test.c Wed Oct 12 23:52:17 2005
@@ -0,0 +1,14 @@
+#include "util_log_test.h"
+
+void Testaxis2_log_ops_write(CuTest *tc) 
+{
+
+    char actual[10];
+    axis2_allocator_t *allocator = axis2_allocator_init(NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, 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);
+}
+

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_log_test.h (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_log_test.h Wed Oct 12 23:52:17 2005
@@ -0,0 +1,12 @@
+#ifndef UTIL_LOG_TEST_H
+#define UTIL_LOG_TEST_H
+
+#include <string.h>
+#include <stdio.h>
+#include <CuTest.h>
+#include <axis2_allocator.h>
+#include <axis2_environment.h>
+
+void Testaxis2_log_ops_write(CuTest *tc);
+
+#endif /* UTIL_LOG_TEST_H*/

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_stream_test.c (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.c Wed Oct 12 23:52:17 2005
@@ -0,0 +1,22 @@
+#include "util_stream_test.h"
+
+void Testaxis2_stream_ops_read(CuTest *tc) {
+
+    char actual[10];
+    axis2_allocator_t *allocator = axis2_allocator_init(NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL);
+    axis2_stream_read(env->stream, actual, 10);
+    char *expected = strdup("aaaaaaaaa");
+    CuAssertStrEquals(tc, expected, actual);
+}
+
+void Testaxis2_stream_ops_write(CuTest *tc) {
+
+    char actual[10];
+    axis2_allocator_t *allocator = axis2_allocator_init(NULL);
+    axis2_environment_t *env = axis2_environment_create(allocator, NULL, NULL, NULL);
+    axis2_stream_read(env->stream, actual, 10);
+    axis2_stream_write(env->stream, actual, 10);
+    char *expected = strdup("aaaaaaaaa");
+    CuAssertStrEquals(tc, expected, actual);
+}

Added: 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=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_stream_test.h (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_stream_test.h Wed Oct 12 23:52:17 2005
@@ -0,0 +1,14 @@
+#ifndef UTIL_STREAM_TEST_H
+#define UTIL_STREAM_TEST_H
+
+#include <string.h>
+#include <stdio.h>
+#include <CuTest.h>
+#include <axis2_allocator.h>
+#include <axis2_environment.h>
+
+void Testaxis2_stream_ops_read(CuTest *tc);
+
+void Testaxis2_stream_ops_write(CuTest *tc);
+
+#endif /* UTIL_STREAM_TEST_H*/

Added: webservices/axis2/trunk/c/modules/util/test/util_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_test.c?rev=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_test.c (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_test.c Wed Oct 12 23:52:17 2005
@@ -0,0 +1,15 @@
+#include "util_test.h"
+#include <string.h>
+#include <stdio.h>
+#include <axis2_allocator.h>
+#include <axis2_environment.h>
+
+CuSuite* axis2_utilGetSuite() {
+    CuSuite* suite = CuSuiteNew();
+    SUITE_ADD_TEST(suite, Testaxis2_stream_ops_read);
+    SUITE_ADD_TEST(suite, Testaxis2_stream_ops_write);
+    SUITE_ADD_TEST(suite, Testaxis2_log_ops_write);
+    SUITE_ADD_TEST(suite, Testaxis2_hash_ops_get);
+    return suite;
+}
+

Added: webservices/axis2/trunk/c/modules/util/test/util_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/test/util_test.h?rev=320676&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/test/util_test.h (added)
+++ webservices/axis2/trunk/c/modules/util/test/util_test.h Wed Oct 12 23:52:17 2005
@@ -0,0 +1,12 @@
+#ifndef UTIL_TEST_H
+#define UTIL_TEST_H
+
+#include <CuTest.h>
+#include "util_stream_test.h"
+#include "util_log_test.h"
+#include "util_hash_test.h"
+#include "util_error_test.h"
+
+CuSuite* axis2_utilGetSuite();
+
+#endif /* UTIL_TEST_H */