This source file includes following definitions.
- bad_input
- starts_with
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13
14 static void
15 bad_input(void **state) {
16 assert_false(pcmk__starts_with(NULL, "x"));
17 assert_false(pcmk__starts_with("abc", NULL));
18 }
19
20 static void
21 starts_with(void **state) {
22 assert_true(pcmk__starts_with("abc", "a"));
23 assert_true(pcmk__starts_with("abc", "ab"));
24 assert_true(pcmk__starts_with("abc", "abc"));
25
26 assert_false(pcmk__starts_with("abc", "A"));
27 assert_false(pcmk__starts_with("abc", "bc"));
28
29 assert_false(pcmk__starts_with("", "x"));
30 assert_true(pcmk__starts_with("xyz", ""));
31 }
32
33 PCMK__UNIT_TEST(NULL, NULL,
34 cmocka_unit_test(bad_input),
35 cmocka_unit_test(starts_with))