pacemaker  2.0.4-2deceaa
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcmk_str_is_minus_infinity.c
Go to the documentation of this file.
1 #include <glib.h>
2 
3 #include <crm_internal.h>
4 
5 static void
6 uppercase_str_passes(void) {
7  g_assert(pcmk_str_is_minus_infinity("-INFINITY") == TRUE);
8 }
9 
10 static void
11 mixed_case_str_fails(void) {
12  g_assert(pcmk_str_is_minus_infinity("-infinity") == FALSE);
13  g_assert(pcmk_str_is_minus_infinity("-Infinity") == FALSE);
14 }
15 
16 static void
17 added_whitespace_fails(void) {
18  g_assert(pcmk_str_is_minus_infinity(" -INFINITY") == FALSE);
19  g_assert(pcmk_str_is_minus_infinity("-INFINITY ") == FALSE);
20  g_assert(pcmk_str_is_minus_infinity(" -INFINITY ") == FALSE);
21  g_assert(pcmk_str_is_minus_infinity("- INFINITY") == FALSE);
22 }
23 
24 static void
25 empty_str_fails(void) {
26  g_assert(pcmk_str_is_minus_infinity(NULL) == FALSE);
27  g_assert(pcmk_str_is_minus_infinity("") == FALSE);
28 }
29 
30 static void
31 infinity_fails(void) {
32  g_assert(pcmk_str_is_minus_infinity("INFINITY") == FALSE);
33 }
34 
35 int main(int argc, char **argv) {
36  g_test_init(&argc, &argv, NULL);
37 
38  g_test_add_func("/common/utils/minus_infinity/uppercase", uppercase_str_passes);
39  g_test_add_func("/common/utils/minus_infinity/mixed_case", mixed_case_str_fails);
40  g_test_add_func("/common/utils/minus_infinity/whitespace", added_whitespace_fails);
41  g_test_add_func("/common/utils/minus_infinity/empty", empty_str_fails);
42  g_test_add_func("/common/utils/minus_infinity/infinity", infinity_fails);
43 
44  return g_test_run();
45 }
bool pcmk_str_is_minus_infinity(const char *s)
Definition: utils.c:625
int main(int argc, char **argv)