summaryrefslogtreecommitdiffstats
path: root/tools/tcpmon/test
diff options
context:
space:
mode:
authorGravatar gmcdonald2010-02-13 01:32:03 +0000
committerGravatar gmcdonald2010-02-13 01:32:03 +0000
commit0425aadc78680e53000fd0108b540d6eca048516 (patch)
tree8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /tools/tcpmon/test
downloadaxis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz
axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2
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
Diffstat (limited to 'tools/tcpmon/test')
-rw-r--r--tools/tcpmon/test/Makefile.am1
-rw-r--r--tools/tcpmon/test/unit/Makefile.am19
-rw-r--r--tools/tcpmon/test/unit/main.c44
-rw-r--r--tools/tcpmon/test/unit/result14
-rw-r--r--tools/tcpmon/test/unit/tcpmon_test.c85
-rw-r--r--tools/tcpmon/test/unit/tcpmon_test.h9
6 files changed, 172 insertions, 0 deletions
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 <CuTest.h>
+#include <stdio.h>
+#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 <<input>
+ check for one step
+ </input>
+ > but was <<input>
+ check for one step
+</input>
+í>
+
+!!!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 <CuTest.h>
+#include <axutil_utils.h>
+#include "tcpmon_test.h"
+#include <stdlib.h>
+#include <axutil_string.h>
+
+#include <tcpmon_util.h>
+
+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, "<input>check for one step</input>");
+ actual = (char *) tcpmon_util_format_as_xml(env, input);
+ expected = "<input>\n" "\tcheck for one step\n" "</input>\n";
+ CuAssertStrEquals(tc, expected, actual);
+ free(actual);
+ free(input);
+
+ input =
+ (char *) axutil_strdup(env,
+ "<input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
+ actual = (char *) tcpmon_util_format_as_xml(env, input);
+ expected =
+ "<input>\n"
+ "\t<tag2>\n"
+ "\t\t<another_tag with='attriutes'>\n"
+ "\t\t\tcheck for one step\n"
+ "\t\t</another_tag>\n" "\t</tag2>\n" "</input>\n";
+
+ CuAssertStrEquals(tc, expected, actual);
+ free(actual);
+ free(input);
+
+ input = (char *) axutil_strdup(env,
+ "<?processing inc?><input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
+ actual = (char *) tcpmon_util_format_as_xml(env, input);
+ expected = "<?processing inc?>\n"
+ "<input>\n"
+ "\t<tag2>\n"
+ "\t\t<another_tag with='attriutes'>\n"
+ "\t\t\tcheck for one step\n"
+ "\t\t</another_tag>\n" "\t</tag2>\n" "</input>\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 <CuTest.h>
+
+CuSuite *tcpmon_GetSuite(
+);
+
+#endif /* TCPMON_TEST_H */