21 add_words(
void **state)
26 pcmk__add_word(&list, &list_len,
"hello");
27 pcmk__add_word(&list, &list_len,
"world");
28 assert_int_equal(strcmp(list,
"hello world"), 0);
33 add_with_no_len(
void **state)
37 pcmk__add_word(&list, NULL,
"hello");
38 pcmk__add_word(&list, NULL,
"world");
39 assert_int_equal(strcmp(list,
"hello world"), 0);
44 add_nothing(
void **state)
48 pcmk__add_word(&list, NULL,
"hello");
49 pcmk__add_word(&list, NULL, NULL);
50 pcmk__add_word(&list, NULL,
"");
51 assert_int_equal(strcmp(list,
"hello"), 0);
56 add_with_null(
void **state)
64 assert_int_equal(strcmp(list,
"hello world I am a unit test"), 0);
69 add_with_comma(
void **state)
77 assert_int_equal(strcmp(list,
"hello,world,I am a unit test"), 0);
82 add_with_comma_and_space(
void **state)
90 assert_int_equal(strcmp(list,
"hello, world, I am a unit test"), 0);
95 main(
int argc,
char **argv)
97 const struct CMUnitTest tests[] = {
98 cmocka_unit_test(add_words),
99 cmocka_unit_test(add_with_no_len),
100 cmocka_unit_test(add_nothing),
101 cmocka_unit_test(add_with_null),
102 cmocka_unit_test(add_with_comma),
103 cmocka_unit_test(add_with_comma_and_space),
106 cmocka_set_message_output(CM_OUTPUT_TAP);
107 return cmocka_run_group_tests(tests, NULL, NULL);
void pcmk__add_separated_word(char **list, size_t *len, const char *word, const char *separator)
int main(int argc, char **argv)