AM_LDFLAGS = $(DEF_LDFLAGS) -R $(libdir)
TESTS = check_osrf_message check_osrf_json_object check_osrf_list check_osrf_stack check_transport_client \
- check_transport_message
+ check_transport_message check_osrf_utils
check_PROGRAMS = check_osrf_message check_osrf_json_object check_osrf_list check_osrf_stack check_transport_client \
- check_transport_message
+ check_transport_message check_osrf_utils
check_osrf_message_SOURCES = $(COMMON) $(OSRF_INC)/osrf_message.h check_osrf_message.c
check_osrf_message_CFLAGS = @CHECK_CFLAGS@ $(DEF_CFLAGS)
check_transport_message_SOURCES = $(COMMON) $(OSRF_INC)/transport_message.h check_transport_message.c
check_transport_message_CFLAGS = @CHECK_CFLAGS@ $(DEF_CFLAGS)
check_transport_message_LDADD = @CHECK_LIBS@ $(top_builddir)/src/libopensrf/libopensrf.la
+
+check_osrf_utils_SOURCES = $(COMMON) $(OSRF_INC)/utils.h check_osrf_utils.c
+check_osrf_utils_CFLAGS = @CHECK_CFLAGS@ $(DEF_CFLAGS)
+check_osrf_utils_LDADD = @CHECK_LIBS@ $(top_builddir)/src/libopensrf/libopensrf.la
--- /dev/null
+#include <check.h>
+#include "opensrf/utils.h"
+
+
+
+//Set up the test fixture
+void setup(void){
+}
+
+//Clean up the test fixture
+void teardown(void){
+}
+
+// BEGIN TESTS
+
+START_TEST(test_osrfXmlEscapingLength)
+ const char* ordinary = "12345";
+ fail_unless(osrfXmlEscapingLength(ordinary) == 0,
+ "osrfXmlEscapingLength should return 0 if string has no special characters");
+ const char* special = "<tag attr=\"attribute value\">a & b</tag>";
+ ck_assert_int_eq(osrfXmlEscapingLength(special), 38);
+END_TEST
+
+//END TESTS
+
+Suite *osrf_utils_suite(void) {
+ //Create test suite, test case, initialize fixture
+ Suite *s = suite_create("osrf_utils");
+ TCase *tc_core = tcase_create("Core");
+ tcase_add_checked_fixture(tc_core, setup, teardown);
+
+ //Add tests to test case
+ tcase_add_test(tc_core, test_osrfXmlEscapingLength);
+
+ //Add test case to test suite
+ suite_add_tcase(s, tc_core);
+
+ return s;
+}
+
+void run_tests(SRunner *sr) {
+ srunner_add_suite(sr, osrf_utils_suite());
+}