123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #define TEST_SUITE_NAME "/lib"
- #include "tests/mctest.h"
- #include <stdio.h>
- #include "lib/strutil.h"
- #include "lib/util.h"
- static void
- setup (void)
- {
- }
- static void
- teardown (void)
- {
- }
- static const struct test_x_basename_ds
- {
- const char *input_value;
- const char *expected_result;
- } test_x_basename_ds[] =
- {
- {
- "/test/path/test2/path2",
- "path2"
- },
- {
- "/test/path/test2/path2#vfsprefix",
- "path2#vfsprefix"
- },
- {
- "/test/path/test2/path2/vfsprefix://",
- "path2/vfsprefix://"
- },
- {
- "/test/path/test2/path2/vfsprefix://subdir",
- "subdir"
- },
- {
- "/test/path/test2/path2/vfsprefix://subdir/",
- "subdir/"
- },
- {
- "/test/path/test2/path2/vfsprefix://subdir/subdir2",
- "subdir2"
- },
- {
- "/test/path/test2/path2/vfsprefix:///",
- "/"
- },
- };
- START_PARAMETRIZED_TEST (test_x_basename, test_x_basename_ds)
- {
-
- const char *actual_result;
-
- actual_result = x_basename (data->input_value);
-
- mctest_assert_str_eq (actual_result, data->expected_result);
- }
- END_PARAMETRIZED_TEST
- int
- main (void)
- {
- TCase *tc_core;
- tc_core = tcase_create ("Core");
- tcase_add_checked_fixture (tc_core, setup, teardown);
-
- mctest_add_parameterized_test (tc_core, test_x_basename, test_x_basename_ds);
-
- return mctest_run_all (tc_core);
- }
|