root/lib/common/tests/strings/pcmk__s_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. s_is_null
  2. s_is_not_null

   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 <crm/common/unittest_internal.h>
  13 
  14 static void
  15 s_is_null(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  16     assert_null(pcmk__s(NULL, NULL));
  17     assert_string_equal(pcmk__s(NULL, ""), "");
  18     assert_string_equal(pcmk__s(NULL, "something"), "something");
  19 }
  20 
  21 static void
  22 s_is_not_null(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  23     assert_string_equal(pcmk__s("something", NULL), "something");
  24     assert_string_equal(pcmk__s("something", "default"), "something");
  25 }
  26 
  27 PCMK__UNIT_TEST(NULL, NULL,
  28                 cmocka_unit_test(s_is_null),
  29                 cmocka_unit_test(s_is_not_null))

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