diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-08 22:13:35 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-08 22:13:35 +0200 |
commit | cf7449c525ba24fe17bc0d4578c9f6ce8925c6e8 (patch) | |
tree | d5ab89a4cee7c3b30a68bb36732605bbc3787649 /tests/unittests | |
parent | b0cdbf5b22248e9c8e28d5b92cb3c92e2a99d583 (diff) | |
download | libssh-cf7449c525ba24fe17bc0d4578c9f6ce8925c6e8.tar.gz libssh-cf7449c525ba24fe17bc0d4578c9f6ce8925c6e8.tar.xz libssh-cf7449c525ba24fe17bc0d4578c9f6ce8925c6e8.zip |
Added tests for ssh_dirname and ssh_basename
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/torture_misc.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index 088052e..bcede39 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -6,6 +6,7 @@ #include "torture.h" #include "misc.c" +#define DIR "/usr/local/bin/truc/much/.." START_TEST (torture_get_user_home_dir) { @@ -21,10 +22,40 @@ START_TEST (torture_get_user_home_dir) } END_TEST +START_TEST (torture_basename) +{ + char *path; + path=ssh_basename(DIR "/test"); + ck_assert(path != NULL); + ck_assert_str_eq(path, "test"); + SAFE_FREE(path); + path=ssh_basename(DIR "/test/"); + ck_assert(path != NULL); + ck_assert_str_eq(path, "test"); + SAFE_FREE(path); +} +END_TEST + +START_TEST (torture_dirname) +{ + char *path; + path=ssh_dirname(DIR "/test"); + ck_assert(path != NULL); + ck_assert_str_eq(path, DIR ); + SAFE_FREE(path); + path=ssh_dirname(DIR "/test/"); + ck_assert(path != NULL); + ck_assert_str_eq(path, DIR); + SAFE_FREE(path); +} +END_TEST + static Suite *torture_make_suite(void) { Suite *s = suite_create("libssh_misc"); torture_create_case(s, "torture_get_user_home_dir", torture_get_user_home_dir); + torture_create_case(s, "torture_basename", torture_basename); + torture_create_case(s, "torture_dirname", torture_dirname); return s; } |