20 #define LISTS_EQ(a, b) { \    21     assert_int_equal(g_strv_length((gchar **) (a)), g_strv_length((gchar **) (b))); \    22     for (int i = 0; i < g_strv_length((a)); i++) { \    23         assert_string_equal((a)[i], (b)[i]); \    28 empty_input(
void **state) {
    33 no_specials(
void **state) {
    34     const char *argv[] = { 
"-a", 
"-b", 
"-c", 
"-d", NULL };
    35     const gchar *expected[] = { 
"-a", 
"-b", 
"-c", 
"-d", NULL };
    39     g_strfreev(processed);
    43     g_strfreev(processed);
    47 single_dash(
void **state) {
    48     const char *argv[] = { 
"-", NULL };
    49     const gchar *expected[] = { 
"-", NULL };
    53     g_strfreev(processed);
    57 double_dash(
void **state) {
    58     const char *argv[] = { 
"-a", 
"--", 
"-bc", NULL };
    59     const gchar *expected[] = { 
"-a", 
"--", 
"-bc", NULL };
    63     g_strfreev(processed);
    67 special_args(
void **state) {
    68     const char *argv[] = { 
"-aX", 
"-Fval", NULL };
    69     const gchar *expected[] = { 
"-a", 
"X", 
"-F", 
"val", NULL };
    73     g_strfreev(processed);
    77 special_arg_at_end(
void **state) {
    78     const char *argv[] = { 
"-a", NULL };
    79     const gchar *expected[] = { 
"-a", NULL };
    83     g_strfreev(processed);
    87 long_arg(
void **state) {
    88     const char *argv[] = { 
"--blah=foo", NULL };
    89     const gchar *expected[] = { 
"--blah=foo", NULL };
    93     g_strfreev(processed);
    97 negative_score(
void **state) {
    98     const char *argv[] = { 
"-v", 
"-1000", NULL };
    99     const gchar *expected[] = { 
"-v", 
"-1000", NULL };
   103     g_strfreev(processed);
   107 negative_score_2(
void **state) {
   108     const char *argv[] = { 
"-1i3", NULL };
   109     const gchar *expected[] = { 
"-1", 
"-i", 
"-3", NULL };
   113     g_strfreev(processed);
   117 string_arg_with_dash(
void **state) {
   118     const char *argv[] = { 
"-n", 
"crm_mon_options", 
"-v", 
"--opt1 --opt2", NULL };
   119     const gchar *expected[] = { 
"-n", 
"crm_mon_options", 
"-v", 
"--opt1 --opt2", NULL };
   123     g_strfreev(processed);
   127 string_arg_with_dash_2(
void **state) {
   128     const char *argv[] = { 
"-n", 
"crm_mon_options", 
"-v", 
"-1i3", NULL };
   129     const gchar *expected[] = { 
"-n", 
"crm_mon_options", 
"-v", 
"-1i3", NULL };
   133     g_strfreev(processed);
   137 string_arg_with_dash_3(
void **state) {
   138     const char *argv[] = { 
"-abc", 
"-1i3", NULL };
   139     const gchar *expected[] = { 
"-a", 
"-b", 
"-c", 
"-1i3", NULL };
   143     g_strfreev(processed);
   149     const struct CMUnitTest tests[] = {
   150         cmocka_unit_test(empty_input),
   151         cmocka_unit_test(no_specials),
   152         cmocka_unit_test(single_dash),
   153         cmocka_unit_test(double_dash),
   154         cmocka_unit_test(special_args),
   155         cmocka_unit_test(special_arg_at_end),
   156         cmocka_unit_test(long_arg),
   157         cmocka_unit_test(negative_score),
   158         cmocka_unit_test(negative_score_2),
   159         cmocka_unit_test(string_arg_with_dash),
   160         cmocka_unit_test(string_arg_with_dash_2),
   161         cmocka_unit_test(string_arg_with_dash_3),
   164     cmocka_set_message_output(CM_OUTPUT_TAP);
   165     return cmocka_run_group_tests(tests, NULL, NULL);
 
gchar ** pcmk__cmdline_preproc(char **argv, const char *special)
 
int main(int argc, char **argv)