pacemaker
2.1.1-52dc28db4
Scalable High-Availability cluster resource manager
lib
common
tests
utils
pcmk_str_is_minus_infinity_test.c
Go to the documentation of this file.
1
/*
2
* Copyright 2020-2021 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This source code is licensed under the GNU Lesser General Public License
7
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8
*/
9
10
#include <
crm_internal.h
>
11
12
#include <stdio.h>
13
#include <stdbool.h>
14
#include <glib.h>
15
16
static
void
17
uppercase_str_passes(
void
)
18
{
19
g_assert_true(
pcmk_str_is_minus_infinity
(
"-INFINITY"
));
20
}
21
22
static
void
23
mixed_case_str_fails(
void
)
24
{
25
g_assert_false(
pcmk_str_is_minus_infinity
(
"-infinity"
));
26
g_assert_false(
pcmk_str_is_minus_infinity
(
"-Infinity"
));
27
}
28
29
static
void
30
added_whitespace_fails(
void
)
31
{
32
g_assert_false(
pcmk_str_is_minus_infinity
(
" -INFINITY"
));
33
g_assert_false(
pcmk_str_is_minus_infinity
(
"-INFINITY "
));
34
g_assert_false(
pcmk_str_is_minus_infinity
(
" -INFINITY "
));
35
g_assert_false(
pcmk_str_is_minus_infinity
(
"- INFINITY"
));
36
}
37
38
static
void
39
empty_str_fails(
void
)
40
{
41
g_assert_false(
pcmk_str_is_minus_infinity
(NULL));
42
g_assert_false(
pcmk_str_is_minus_infinity
(
""
));
43
}
44
45
static
void
46
infinity_fails(
void
)
47
{
48
g_assert_false(
pcmk_str_is_minus_infinity
(
"INFINITY"
));
49
}
50
51
int
main
(
int
argc,
char
**argv)
52
{
53
g_test_init(&argc, &argv, NULL);
54
55
g_test_add_func(
"/common/utils/minus_infinity/uppercase"
, uppercase_str_passes);
56
g_test_add_func(
"/common/utils/minus_infinity/mixed_case"
, mixed_case_str_fails);
57
g_test_add_func(
"/common/utils/minus_infinity/whitespace"
, added_whitespace_fails);
58
g_test_add_func(
"/common/utils/minus_infinity/empty"
, empty_str_fails);
59
g_test_add_func(
"/common/utils/minus_infinity/infinity"
, infinity_fails);
60
61
return
g_test_run();
62
}
crm_internal.h
main
int main(int argc, char **argv)
Definition:
pcmk_str_is_minus_infinity_test.c:51
pcmk_str_is_minus_infinity
bool pcmk_str_is_minus_infinity(const char *s)
Definition:
utils.c:590
Generated on Fri Sep 10 2021 09:15:59 for pacemaker by
1.8.14