2 #include "opensrf/utils.h"
6 //Set up the test fixture
10 //Clean up the test fixture
16 START_TEST(test_osrfXmlEscapingLength)
17 const char* ordinary = "12345";
18 fail_unless(osrfXmlEscapingLength(ordinary) == 0,
19 "osrfXmlEscapingLength should return 0 if string has no special characters");
20 const char* special = "<tag attr=\"attribute value\">a & b</tag>";
21 ck_assert_int_eq(osrfXmlEscapingLength(special), 38);
26 Suite *osrf_utils_suite(void) {
27 //Create test suite, test case, initialize fixture
28 Suite *s = suite_create("osrf_utils");
29 TCase *tc_core = tcase_create("Core");
30 tcase_add_checked_fixture(tc_core, setup, teardown);
32 //Add tests to test case
33 tcase_add_test(tc_core, test_osrfXmlEscapingLength);
35 //Add test case to test suite
36 suite_add_tcase(s, tc_core);
41 void run_tests(SRunner *sr) {
42 srunner_add_suite(sr, osrf_utils_suite());