This source file includes following definitions.
- uppercase_str_passes
- mixed_case_str_fails
- added_whitespace_fails
- empty_str_fails
- infinity_fails
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 uppercase_str_passes(void **state)
16 {
17 assert_true(pcmk_str_is_minus_infinity("-INFINITY"));
18 }
19
20 static void
21 mixed_case_str_fails(void **state)
22 {
23 assert_false(pcmk_str_is_minus_infinity("-infinity"));
24 assert_false(pcmk_str_is_minus_infinity("-Infinity"));
25 }
26
27 static void
28 added_whitespace_fails(void **state)
29 {
30 assert_false(pcmk_str_is_minus_infinity(" -INFINITY"));
31 assert_false(pcmk_str_is_minus_infinity("-INFINITY "));
32 assert_false(pcmk_str_is_minus_infinity(" -INFINITY "));
33 assert_false(pcmk_str_is_minus_infinity("- INFINITY"));
34 }
35
36 static void
37 empty_str_fails(void **state)
38 {
39 assert_false(pcmk_str_is_minus_infinity(NULL));
40 assert_false(pcmk_str_is_minus_infinity(""));
41 }
42
43 static void
44 infinity_fails(void **state)
45 {
46 assert_false(pcmk_str_is_minus_infinity("INFINITY"));
47 }
48
49 PCMK__UNIT_TEST(NULL, NULL,
50 cmocka_unit_test(uppercase_str_passes),
51 cmocka_unit_test(mixed_case_str_fails),
52 cmocka_unit_test(added_whitespace_fails),
53 cmocka_unit_test(empty_str_fails),
54 cmocka_unit_test(infinity_fails))