This source file includes following definitions.
- uppercase_str_passes
- mixed_case_str_fails
- added_whitespace_fails
- empty_str_fails
- infinity_fails
- main
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdarg.h>
13 #include <stddef.h>
14 #include <stdint.h>
15 #include <setjmp.h>
16 #include <cmocka.h>
17
18 static void
19 uppercase_str_passes(void **state)
20 {
21 assert_true(pcmk_str_is_minus_infinity("-INFINITY"));
22 }
23
24 static void
25 mixed_case_str_fails(void **state)
26 {
27 assert_false(pcmk_str_is_minus_infinity("-infinity"));
28 assert_false(pcmk_str_is_minus_infinity("-Infinity"));
29 }
30
31 static void
32 added_whitespace_fails(void **state)
33 {
34 assert_false(pcmk_str_is_minus_infinity(" -INFINITY"));
35 assert_false(pcmk_str_is_minus_infinity("-INFINITY "));
36 assert_false(pcmk_str_is_minus_infinity(" -INFINITY "));
37 assert_false(pcmk_str_is_minus_infinity("- INFINITY"));
38 }
39
40 static void
41 empty_str_fails(void **state)
42 {
43 assert_false(pcmk_str_is_minus_infinity(NULL));
44 assert_false(pcmk_str_is_minus_infinity(""));
45 }
46
47 static void
48 infinity_fails(void **state)
49 {
50 assert_false(pcmk_str_is_minus_infinity("INFINITY"));
51 }
52
53 int main(int argc, char **argv)
54 {
55 const struct CMUnitTest tests[] = {
56 cmocka_unit_test(uppercase_str_passes),
57 cmocka_unit_test(mixed_case_str_fails),
58 cmocka_unit_test(added_whitespace_fails),
59 cmocka_unit_test(empty_str_fails),
60 cmocka_unit_test(infinity_fails),
61 };
62
63 cmocka_set_message_output(CM_OUTPUT_TAP);
64 return cmocka_run_group_tests(tests, NULL, NULL);
65 }