X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-strv.c;h=074e1bb3d411c399a5401b2dd7d260ab9f2891fe;hp=504415ac0ce0530ca8dc61fac3b9cb37d368f550;hb=a016b9228f338cb9b380ce7e00826ef462767d98;hpb=9f316366482471667dca20aba34c1f3a36fd56c3 diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 504415ac0..074e1bb3d 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -161,7 +161,7 @@ static void test_strv_overlap(void) { } static void test_strv_sort(void) { - const char * const input_table[] = { + const char* input_table[] = { "durian", "apple", "citrus", @@ -233,8 +233,23 @@ static void test_strv_append(void) { assert_se(streq(c[0], "test3")); } +static void test_strv_foreach_pair(void) { + _cleanup_strv_free_ char **a = NULL; + char **x, **y; + + a = strv_new("pair_one", "pair_one", + "pair_two", "pair_two", + "pair_three", "pair_three", + NULL); + + STRV_FOREACH_PAIR(x, y, a) { + assert_se(streq(*x, *y)); + } +} + int main(int argc, char *argv[]) { test_specifier_printf(); + test_strv_foreach_pair(); test_strv_find(); test_strv_find_prefix(); test_strv_join();