This source file includes following definitions.
- valid
- invalid
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 valid(void **state) {
16 assert_int_equal(pcmk__parse_health_strategy(NULL),
17 pcmk__health_strategy_none);
18
19 assert_int_equal(pcmk__parse_health_strategy(PCMK_VALUE_NONE),
20 pcmk__health_strategy_none);
21
22 assert_int_equal(pcmk__parse_health_strategy("NONE"),
23 pcmk__health_strategy_none);
24
25 assert_int_equal(pcmk__parse_health_strategy("None"),
26 pcmk__health_strategy_none);
27
28 assert_int_equal(pcmk__parse_health_strategy("nOnE"),
29 pcmk__health_strategy_none);
30
31 assert_int_equal(pcmk__parse_health_strategy("migrate-on-red"),
32 pcmk__health_strategy_no_red);
33
34 assert_int_equal(pcmk__parse_health_strategy("only-green"),
35 pcmk__health_strategy_only_green);
36
37 assert_int_equal(pcmk__parse_health_strategy("progressive"),
38 pcmk__health_strategy_progressive);
39
40 assert_int_equal(pcmk__parse_health_strategy("custom"),
41 pcmk__health_strategy_custom);
42 }
43
44 static void
45 invalid(void **state) {
46 assert_int_equal(pcmk__parse_health_strategy("foo"),
47 pcmk__health_strategy_none);
48 assert_int_equal(pcmk__parse_health_strategy("custom1"),
49 pcmk__health_strategy_none);
50 assert_int_equal(pcmk__parse_health_strategy("not-only-green-here"),
51 pcmk__health_strategy_none);
52 }
53
54 PCMK__UNIT_TEST(NULL, NULL,
55 cmocka_unit_test(valid),
56 cmocka_unit_test(invalid))