]> git.evergreen-ils.org Git - OpenSRF.git/blob - tests/check_osrf_utils.c
LP1999823: Bump libtool library version
[OpenSRF.git] / tests / check_osrf_utils.c
1 #include <check.h>
2 #include "opensrf/utils.h"
3
4
5
6 //Set up the test fixture
7 void setup(void){
8 }
9
10 //Clean up the test fixture
11 void teardown(void){
12 }
13
14 // BEGIN TESTS
15
16 START_TEST(test_osrfXmlEscapingLength)
17 {
18   const char* ordinary = "12345";
19   fail_unless(osrfXmlEscapingLength(ordinary) == 0,
20       "osrfXmlEscapingLength should return 0 if string has no special characters");
21   const char* special = "<tag attr=\"attribute value\">a &amp; b</tag>";
22   ck_assert_int_eq(osrfXmlEscapingLength(special), 38);
23 }
24 END_TEST
25
26 //END TESTS
27
28 Suite *osrf_utils_suite(void) {
29   //Create test suite, test case, initialize fixture
30   Suite *s = suite_create("osrf_utils");
31   TCase *tc_core = tcase_create("Core");
32   tcase_add_checked_fixture(tc_core, setup, teardown);
33
34   //Add tests to test case
35   tcase_add_test(tc_core, test_osrfXmlEscapingLength);
36
37   //Add test case to test suite
38   suite_add_tcase(s, tc_core);
39
40   return s;
41 }
42
43 void run_tests(SRunner *sr) {
44   srunner_add_suite(sr, osrf_utils_suite());
45 }