From 0425aadc78680e53000fd0108b540d6eca048516 Mon Sep 17 00:00:00 2001 From: gmcdonald Date: Sat, 13 Feb 2010 01:32:03 +0000 Subject: Moving axis svn, part of TLP move INFRA-2441 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68 --- tools/tcpmon/test/Makefile.am | 1 + tools/tcpmon/test/unit/Makefile.am | 19 ++++++++ tools/tcpmon/test/unit/main.c | 44 +++++++++++++++++++ tools/tcpmon/test/unit/result | 14 ++++++ tools/tcpmon/test/unit/tcpmon_test.c | 85 ++++++++++++++++++++++++++++++++++++ tools/tcpmon/test/unit/tcpmon_test.h | 9 ++++ 6 files changed, 172 insertions(+) create mode 100644 tools/tcpmon/test/Makefile.am create mode 100644 tools/tcpmon/test/unit/Makefile.am create mode 100644 tools/tcpmon/test/unit/main.c create mode 100644 tools/tcpmon/test/unit/result create mode 100644 tools/tcpmon/test/unit/tcpmon_test.c create mode 100644 tools/tcpmon/test/unit/tcpmon_test.h (limited to 'tools/tcpmon/test') diff --git a/tools/tcpmon/test/Makefile.am b/tools/tcpmon/test/Makefile.am new file mode 100644 index 0000000..85eb6ca --- /dev/null +++ b/tools/tcpmon/test/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = unit diff --git a/tools/tcpmon/test/unit/Makefile.am b/tools/tcpmon/test/unit/Makefile.am new file mode 100644 index 0000000..719bd16 --- /dev/null +++ b/tools/tcpmon/test/unit/Makefile.am @@ -0,0 +1,19 @@ +TESTS = +prgbindir=$(prefix)/bin/unit_test +prgbin_PROGRAMS = tcpmon_unit_test_suite + +tcpmon_unit_test_suite_SOURCES = main.c tcpmon_test.c + +tcpmon_unit_test_suite_LDADD = \ + $(top_builddir)/src/libaxis2_tcpmon.la \ + -L$(CUTEST_HOME)/lib \ + -lcutest \ + ../../../../util/src/libaxutil.la \ + ../../../../axiom/src/om/libaxis2_axiom.la \ + $(NULL) + + +INCLUDES = -I${CUTEST_HOME}/include \ + -I$(top_builddir)/include \ + -I ../../../../util/include \ + $(NULL) diff --git a/tools/tcpmon/test/unit/main.c b/tools/tcpmon/test/unit/main.c new file mode 100644 index 0000000..531ed66 --- /dev/null +++ b/tools/tcpmon/test/unit/main.c @@ -0,0 +1,44 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 "tcpmon_test.h" + +void +RunAllTests( + void) +{ + CuString *output = CuStringNew(); + CuSuite *suite = CuSuiteNew(); + + CuSuiteAddSuite(suite, (CuSuite *) tcpmon_GetSuite()); + + CuSuiteRun(suite); + CuSuiteSummary(suite, output); + CuSuiteDetails(suite, output); + printf("%s\n", output->buffer); +} + +int +main( + void) +{ + RunAllTests(); + return 0; +} diff --git a/tools/tcpmon/test/unit/result b/tools/tcpmon/test/unit/result new file mode 100644 index 0000000..130ca3a --- /dev/null +++ b/tools/tcpmon/test/unit/result @@ -0,0 +1,14 @@ +F + +There was 1 failure: +1) test_format_xml: tcpmon_test.c:28: expected < + check for one step + + > but was < + check for one step + +í> + +!!!FAILURES!!! +Runs: 1 Passes: 0 Fails: 1 + diff --git a/tools/tcpmon/test/unit/tcpmon_test.c b/tools/tcpmon/test/unit/tcpmon_test.c new file mode 100644 index 0000000..f5ee7be --- /dev/null +++ b/tools/tcpmon/test/unit/tcpmon_test.c @@ -0,0 +1,85 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 "tcpmon_test.h" +#include +#include + +#include + +void +test_format_xml( + CuTest * tc) +{ + axutil_env_t *env; + axutil_allocator_t *allocator; + axis2_char_t *input; + axis2_char_t *actual; + axis2_char_t *expected; + + allocator = axutil_allocator_init(NULL); + env = axutil_env_create(allocator); + + input = (char *) axutil_strdup(env, "check for one step"); + actual = (char *) tcpmon_util_format_as_xml(env, input); + expected = "\n" "\tcheck for one step\n" "\n"; + CuAssertStrEquals(tc, expected, actual); + free(actual); + free(input); + + input = + (char *) axutil_strdup(env, + "check for one step"); + actual = (char *) tcpmon_util_format_as_xml(env, input); + expected = + "\n" + "\t\n" + "\t\t\n" + "\t\t\tcheck for one step\n" + "\t\t\n" "\t\n" "\n"; + + CuAssertStrEquals(tc, expected, actual); + free(actual); + free(input); + + input = (char *) axutil_strdup(env, + "check for one step"); + actual = (char *) tcpmon_util_format_as_xml(env, input); + expected = "\n" + "\n" + "\t\n" + "\t\t\n" + "\t\t\tcheck for one step\n" + "\t\t\n" "\t\n" "\n"; + + CuAssertStrEquals(tc, expected, actual); + free(actual); + free(input); + +} + +CuSuite * +tcpmon_GetSuite( + ) +{ + CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_format_xml); + return suite; +} diff --git a/tools/tcpmon/test/unit/tcpmon_test.h b/tools/tcpmon/test/unit/tcpmon_test.h new file mode 100644 index 0000000..66c2e0a --- /dev/null +++ b/tools/tcpmon/test/unit/tcpmon_test.h @@ -0,0 +1,9 @@ +#ifndef TCPMON_TEST_H +#define TCPMON_TEST_H + +#include + +CuSuite *tcpmon_GetSuite( +); + +#endif /* TCPMON_TEST_H */ -- cgit v1.1-32-gdbae