pacemaker  2.1.6-802a72226b
Scalable High-Availability cluster resource manager
pe__cmp_rsc_priority_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2022 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
13 #include <crm/pengine/internal.h>
14 
15 #include "pe_status_private.h"
16 
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))
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
pe_resource_t rsc2
G_GNUC_INTERNAL gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
Definition: utils.c:335
pe_resource_t rsc1