This source file includes following definitions.
- uppercase_str_passes
- mixed_case_str_fails
- added_whitespace_fails
- empty_str_fails
- infinity_fails
- main
1 #include <stdio.h>
2 #include <stdbool.h>
3 #include <glib.h>
4
5 #include <crm_internal.h>
6
7 static void
8 uppercase_str_passes(void)
9 {
10 g_assert_cmpint(pcmk_str_is_minus_infinity("-INFINITY"), ==, true);
11 }
12
13 static void
14 mixed_case_str_fails(void)
15 {
16 g_assert_cmpint(pcmk_str_is_minus_infinity("-infinity"), ==, false);
17 g_assert_cmpint(pcmk_str_is_minus_infinity("-Infinity"), ==, false);
18 }
19
20 static void
21 added_whitespace_fails(void)
22 {
23 g_assert_cmpint(pcmk_str_is_minus_infinity(" -INFINITY"), ==, false);
24 g_assert_cmpint(pcmk_str_is_minus_infinity("-INFINITY "), ==, false);
25 g_assert_cmpint(pcmk_str_is_minus_infinity(" -INFINITY "), ==, false);
26 g_assert_cmpint(pcmk_str_is_minus_infinity("- INFINITY"), ==, false);
27 }
28
29 static void
30 empty_str_fails(void)
31 {
32 g_assert_cmpint(pcmk_str_is_minus_infinity(NULL), ==, false);
33 g_assert_cmpint(pcmk_str_is_minus_infinity(""), ==, false);
34 }
35
36 static void
37 infinity_fails(void)
38 {
39 g_assert_cmpint(pcmk_str_is_minus_infinity("INFINITY"), ==, false);
40 }
41
42 int main(int argc, char **argv)
43 {
44 g_test_init(&argc, &argv, NULL);
45
46 g_test_add_func("/common/utils/minus_infinity/uppercase", uppercase_str_passes);
47 g_test_add_func("/common/utils/minus_infinity/mixed_case", mixed_case_str_fails);
48 g_test_add_func("/common/utils/minus_infinity/whitespace", added_whitespace_fails);
49 g_test_add_func("/common/utils/minus_infinity/empty", empty_str_fails);
50 g_test_add_func("/common/utils/minus_infinity/infinity", infinity_fails);
51
52 return g_test_run();
53 }