]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/c-apps/tests/check_util.c
LP1615805 No inputs after submit in patron search (AngularJS)
[working/Evergreen.git] / Open-ILS / src / c-apps / tests / check_util.c
1 #include <check.h>
2 #include <ctype.h>
3 #include <limits.h>
4 #include "openils/oils_utils.h"
5 #include "openils/oils_idl.h"
6
7 //Set up the test fixture
8 void setup (void) {
9 }
10
11 //Clean up the test fixture
12 void teardown (void) {
13 }
14
15 //Tests
16
17 START_TEST (test_oilsUtilsIsDBTrue)
18 {
19     ck_assert_msg( ! oilsUtilsIsDBTrue("0"),  "oilsUtilIsDBTrue() should be false when passed '0'");
20     ck_assert_msg(   oilsUtilsIsDBTrue("1"),  "oilsUtilIsDBTrue() should be true when passed '1'");
21     ck_assert_msg(   oilsUtilsIsDBTrue("-1"), "oilsUtilIsDBTrue() should be true when passed '-1'");
22     ck_assert_msg(   oilsUtilsIsDBTrue("a"),  "oilsUtilIsDBTrue() should be true when passed 'a'");
23     ck_assert_msg( ! oilsUtilsIsDBTrue("f"),  "oilsUtilIsDBTrue() should be false when passed 'f'");
24 }
25 END_TEST
26
27 //END Tests
28
29 Suite *util_suite (void) {
30   //Create test suite, test case, initialize fixture
31   Suite *s = suite_create("util");
32   TCase *tc_core = tcase_create("Core");
33   tcase_add_checked_fixture(tc_core, setup, teardown);
34
35   //Add tests to test case
36   tcase_add_test(tc_core, test_oilsUtilsIsDBTrue);
37
38   //Add test case to test suite
39   suite_add_tcase(s, tc_core);
40
41   return s;
42 }
43
44 void run_tests (SRunner *sr) {
45   srunner_add_suite (sr, util_suite());
46 }