This source file includes following definitions.
- rscs_equal
- rsc1_first
- rsc2_first
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13 #include <crm/pengine/internal.h>
14
15 #include "pe_status_private.h"
16
17 pe_resource_t rsc1;
18 pe_resource_t rsc2;
19
20 static void
21 rscs_equal(void **state)
22 {
23 rsc1.priority = 0;
24 rsc2.priority = 0;
25 assert_int_equal(pe__cmp_rsc_priority(NULL, NULL), 0);
26 assert_int_equal(pe__cmp_rsc_priority(&rsc1, &rsc2), 0);
27 }
28
29 static void
30 rsc1_first(void **state)
31 {
32 rsc1.priority = 1;
33 rsc2.priority = 0;
34 assert_int_equal(pe__cmp_rsc_priority(&rsc1, NULL), -1);
35 assert_int_equal(pe__cmp_rsc_priority(&rsc1, &rsc2), -1);
36 }
37
38 static void
39 rsc2_first(void **state)
40 {
41 rsc1.priority = 0;
42 rsc2.priority = 1;
43 assert_int_equal(pe__cmp_rsc_priority(NULL, &rsc2), 1);
44 assert_int_equal(pe__cmp_rsc_priority(&rsc1, &rsc2), 1);
45 }
46
47 PCMK__UNIT_TEST(NULL, NULL,
48 cmocka_unit_test(rscs_equal),
49 cmocka_unit_test(rsc1_first),
50 cmocka_unit_test(rsc2_first))