root/lib/pengine/tests/unpack/pe_base_name_end_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. bad_args
  2. no_suffix
  3. has_suffix
  4. main

   1 /*
   2  * Copyright 2022 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 <stdarg.h>
  13 #include <stddef.h>
  14 #include <stdint.h>
  15 #include <setjmp.h>
  16 #include <cmocka.h>
  17 
  18 #include <crm/pengine/internal.h>
  19 
  20 static void
  21 bad_args(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  22     assert_null(pe_base_name_end(NULL));
  23     assert_null(pe_base_name_end(""));
  24 }
  25 
  26 static void
  27 no_suffix(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  28     assert_string_equal(pe_base_name_end("rsc"), "c");
  29     assert_string_equal(pe_base_name_end("rsc0"), "0");
  30 }
  31 
  32 static void
  33 has_suffix(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  34     assert_string_equal(pe_base_name_end("rsc:0"), "c:0");
  35     assert_string_equal(pe_base_name_end("rsc:100"), "c:100");
  36 }
  37 
  38 int main(int argc, char **argv) {
     /* [previous][next][first][last][top][bottom][index][help] */
  39     const struct CMUnitTest tests[] = {
  40         cmocka_unit_test(bad_args),
  41         cmocka_unit_test(no_suffix),
  42         cmocka_unit_test(has_suffix),
  43     };
  44 
  45     cmocka_set_message_output(CM_OUTPUT_TAP);
  46     return cmocka_run_group_tests(tests, NULL, NULL);
  47 }

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