15 add_words(
void **state)
19 pcmk__add_word(&list, 16,
"hello");
20 pcmk__add_word(&list, 16,
"world");
21 assert_int_equal(strcmp((
const char *) list->str,
"hello world"), 0);
22 g_string_free(list, TRUE);
26 add_with_no_len(
void **state)
30 pcmk__add_word(&list, 0,
"hello");
31 pcmk__add_word(&list, 0,
"world");
32 assert_int_equal(strcmp((
const char *) list->str,
"hello world"), 0);
33 g_string_free(list, TRUE);
37 add_nothing(
void **state)
41 pcmk__add_word(&list, 0,
"hello");
42 pcmk__add_word(&list, 0, NULL);
43 pcmk__add_word(&list, 0,
"");
44 assert_int_equal(strcmp((
const char *) list->str,
"hello"), 0);
45 g_string_free(list, TRUE);
49 add_with_null(
void **state)
56 assert_int_equal(strcmp((
const char *) list->str,
57 "hello world I am a unit test"), 0);
58 g_string_free(list, TRUE);
62 add_with_comma(
void **state)
69 assert_int_equal(strcmp((
const char *) list->str,
70 "hello,world,I am a unit test"), 0);
71 g_string_free(list, TRUE);
75 add_with_comma_and_space(
void **state)
82 assert_int_equal(strcmp((
const char *) list->str,
83 "hello, world, I am a unit test"), 0);
84 g_string_free(list, TRUE);
88 cmocka_unit_test(add_words),
89 cmocka_unit_test(add_with_no_len),
90 cmocka_unit_test(add_nothing),
91 cmocka_unit_test(add_with_null),
92 cmocka_unit_test(add_with_comma),
93 cmocka_unit_test(add_with_comma_and_space))
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)