This source file includes following definitions.
- full_path
- main
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdarg.h>
13 #include <stddef.h>
14 #include <stdint.h>
15 #include <string.h>
16 #include <stdlib.h>
17 #include <setjmp.h>
18 #include <cmocka.h>
19
20 static void
21 full_path(void **state)
22 {
23 char *path = NULL;
24
25 path = pcmk__full_path("file", "/dir");
26 assert_int_equal(strcmp(path, "/dir/file"), 0);
27 free(path);
28
29 path = pcmk__full_path("/full/path", "/dir");
30 assert_int_equal(strcmp(path, "/full/path"), 0);
31 free(path);
32
33 path = pcmk__full_path("../relative/path", "/dir");
34 assert_int_equal(strcmp(path, "/dir/../relative/path"), 0);
35 free(path);
36 }
37
38 int
39 main(int argc, char **argv)
40 {
41 const struct CMUnitTest tests[] = {
42 cmocka_unit_test(full_path),
43 };
44
45 cmocka_set_message_output(CM_OUTPUT_TAP);
46 return cmocka_run_group_tests(tests, NULL, NULL);
47 }