tests: move strv related tests to test-strv.c

This commit is contained in:
Ronny Chevalier 2016-03-02 23:01:38 +01:00
parent 6571a64ec9
commit ebde5cb261
2 changed files with 21 additions and 20 deletions

View File

@ -660,6 +660,25 @@ static void test_strv_make_nulstr(void) {
test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux"));
}
static void test_foreach_string(void) {
const char * const t[] = {
"foo",
"bar",
"waldo",
NULL
};
const char *x;
unsigned i = 0;
FOREACH_STRING(x, "foo", "bar", "waldo")
assert_se(streq_ptr(t[i++], x));
assert_se(i == 3);
FOREACH_STRING(x, "zzz")
assert_se(streq(x, "zzz"));
}
int main(int argc, char *argv[]) {
test_specifier_printf();
test_strv_foreach();
@ -724,5 +743,7 @@ int main(int argc, char *argv[]) {
test_strv_extend_n();
test_strv_make_nulstr();
test_foreach_string();
return 0;
}

View File

@ -522,25 +522,6 @@ static void test_log2i(void) {
assert_se(log2i(INT_MAX) == sizeof(int)*8-2);
}
static void test_foreach_string(void) {
const char * const t[] = {
"foo",
"bar",
"waldo",
NULL
};
const char *x;
unsigned i = 0;
FOREACH_STRING(x, "foo", "bar", "waldo")
assert_se(streq_ptr(t[i++], x));
assert_se(i == 3);
FOREACH_STRING(x, "zzz")
assert_se(streq(x, "zzz"));
}
static void test_filename_is_valid(void) {
char foo[FILENAME_MAX+2];
int i;
@ -1073,7 +1054,6 @@ int main(int argc, char *argv[]) {
test_in_set();
test_writing_tmpfile();
test_log2i();
test_foreach_string();
test_filename_is_valid();
test_files_same();
test_is_valid_documentation_url();