aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLee Hambley <lee.hambley@gmail.com>2011-10-28 22:52:03 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-11-03 18:24:02 +0100
commit17f396ffab3a5ad9d9984344cde6793685cf81be (patch)
tree41a12de8543ebc0b7b957c666e2c53aad0289f29 /tests
parent2c04994443384224161d895d00255b5788e8376d (diff)
downloadlibssh-17f396ffab3a5ad9d9984344cde6793685cf81be.tar.gz
libssh-17f396ffab3a5ad9d9984344cde6793685cf81be.tar.xz
libssh-17f396ffab3a5ad9d9984344cde6793685cf81be.zip
Improve ssh_options_get(ssh_session, enum ssh_options_e, char**).
* Use SSH_ERROR and SSH_OK instead of `-1` and `0`. * Re-factor for code duplication * No longer call `ssh_set_error_invalid(ssh_session)` when the ssh_session is NULL.
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/torture_options.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index 3830981a..b90d1638 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -83,7 +83,7 @@ static void torture_options_get_user(void **state) {
char* user = NULL;
int rc;
rc = ssh_options_set(session, SSH_OPTIONS_USER, "magicaltrevor");
- assert_true(rc == 0);
+ assert_true(rc == SSH_OK);
rc = ssh_options_get(session, SSH_OPTIONS_USER, &user);
assert_string_equal(user, "magicaltrevor");
}
@@ -98,7 +98,7 @@ static void torture_options_set_fd(void **state) {
assert_true(session->fd == fd);
rc = ssh_options_set(session, SSH_OPTIONS_FD, NULL);
- assert_true(rc == -1);
+ assert_true(rc == SSH_ERROR);
assert_true(session->fd == SSH_INVALID_SOCKET);
}
@@ -161,14 +161,14 @@ static void torture_options_get_identity(void **state) {
rc = ssh_options_set(session, SSH_OPTIONS_ADD_IDENTITY, "identity1");
assert_true(rc == 0);
rc = ssh_options_get(session, SSH_OPTIONS_IDENTITY, &identity);
- assert_true(rc == 0);
+ assert_true(rc == SSH_OK);
assert_string_equal(identity, "identity1");
rc = ssh_options_set(session, SSH_OPTIONS_IDENTITY, "identity2");
assert_true(rc == 0);
assert_string_equal(session->identity->root->data, "identity2");
rc = ssh_options_get(session, SSH_OPTIONS_IDENTITY, &identity);
- assert_true(rc == 0);
+ assert_true(rc == SSH_OK);
assert_string_equal(identity, "identity2");
}