root/lib/common/tests/utils/pcmk_str_is_minus_infinity_test.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. uppercase_str_passes
  2. mixed_case_str_fails
  3. added_whitespace_fails
  4. empty_str_fails
  5. infinity_fails
  6. 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)
     /* [previous][next][first][last][top][bottom][index][help] */
   9 {
  10     g_assert_cmpint(pcmk_str_is_minus_infinity("-INFINITY"), ==, true);
  11 }
  12 
  13 static void
  14 mixed_case_str_fails(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39     g_assert_cmpint(pcmk_str_is_minus_infinity("INFINITY"), ==, false);
  40 }
  41 
  42 int main(int argc, char **argv)
     /* [previous][next][first][last][top][bottom][index][help] */
  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 }

/* [previous][next][first][last][top][bottom][index][help] */