diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-01-15 13:45:10 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-01-26 13:56:22 +0100 |
commit | 27caaa000b3cb826b54f29bacf15d926c0c19d21 (patch) | |
tree | 5469a99dfedc46ff8b50ebfa3824ae0d098b9c22 | |
parent | bdf968c178d3cb54c0f5f968e2030926614cae21 (diff) | |
download | libssh-27caaa000b3cb826b54f29bacf15d926c0c19d21.tar.gz libssh-27caaa000b3cb826b54f29bacf15d926c0c19d21.tar.xz libssh-27caaa000b3cb826b54f29bacf15d926c0c19d21.zip |
tests: Prefer assert_non_null() over assert_false()
This also replaces some occurrences of assert_true() with assert_null()
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | tests/client/torture_knownhosts.c | 2 | ||||
-rw-r--r-- | tests/client/torture_sftp_dir.c | 2 | ||||
-rw-r--r-- | tests/client/torture_sftp_ext.c | 6 | ||||
-rw-r--r-- | tests/unittests/torture_callbacks.c | 2 | ||||
-rw-r--r-- | tests/unittests/torture_misc.c | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c index e24081ac..40bb3608 100644 --- a/tests/client/torture_knownhosts.c +++ b/tests/client/torture_knownhosts.c @@ -128,7 +128,7 @@ static void torture_knownhosts_port(void **state) { file = fopen(known_hosts_file, "r"); assert_non_null(file); p = fgets(buffer, sizeof(buffer), file); - assert_false(p == NULL); + assert_non_null(p); fclose(file); buffer[sizeof(buffer) - 1] = '\0'; assert_non_null(strstr(buffer,"[127.0.0.10]:1234 ")); diff --git a/tests/client/torture_sftp_dir.c b/tests/client/torture_sftp_dir.c index 5b4cf145..1c4f8391 100644 --- a/tests/client/torture_sftp_dir.c +++ b/tests/client/torture_sftp_dir.c @@ -66,7 +66,7 @@ static void torture_sftp_mkdir(void **state) { char tmpdir[128] = {0}; int rc; - assert_false(t == NULL); + assert_non_null(t); snprintf(tmpdir, sizeof(tmpdir) - 1, "%s/mkdir_test", t->testdir); diff --git a/tests/client/torture_sftp_ext.c b/tests/client/torture_sftp_ext.c index 53a4a34f..ad4bbaa1 100644 --- a/tests/client/torture_sftp_ext.c +++ b/tests/client/torture_sftp_ext.c @@ -11,10 +11,10 @@ static void torture_sftp_ext_new(void **state) { (void) state; x = sftp_ext_new(); - assert_false(x == NULL); + assert_non_null(x); assert_int_equal(x->count, 0); - assert_true(x->name == NULL); - assert_true(x->data == NULL); + assert_null(x->name); + assert_null(x->data); sftp_ext_free(x); } diff --git a/tests/unittests/torture_callbacks.c b/tests/unittests/torture_callbacks.c index f5923309..f5f7e4da 100644 --- a/tests/unittests/torture_callbacks.c +++ b/tests/unittests/torture_callbacks.c @@ -23,7 +23,7 @@ static int setup(void **state) struct ssh_callbacks_struct *cb; cb = malloc(sizeof(struct ssh_callbacks_struct)); - assert_false(cb == NULL); + assert_non_null(cb); ZERO_STRUCTP(cb); cb->userdata = (void *) 0x0badc0de; diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index b891ed68..26da536b 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -44,7 +44,7 @@ static void torture_get_user_home_dir(void **state) { (void) state; user = ssh_get_user_home_dir(); - assert_false(user == NULL); + assert_non_null(user); #ifndef _WIN32 assert_string_equal(user, pwd->pw_dir); #endif /* _WIN32 */ @@ -109,7 +109,7 @@ static void torture_path_expand_tilde_win(void **state) { (void) state; d = ssh_path_expand_tilde("~\\.ssh"); - assert_false(d == NULL); + assert_non_null(d); print_message("Expanded path: %s\n", d); free(d); |