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