mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-03-24 20:40:09 +09:00
tests: add coverage for NULL session in ssh_channel_is_open
Signed-off-by: Manas Trivedi <manas.trivedi.020@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
34bbb48561
commit
9f7c596ca5
@@ -39,10 +39,29 @@ static void torture_channel_select(void **state)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void torture_channel_null_session(void **state)
|
||||
{
|
||||
ssh_channel channel = NULL;
|
||||
|
||||
(void)state;
|
||||
|
||||
channel = calloc(1, sizeof(struct ssh_channel_struct));
|
||||
|
||||
assert_non_null(channel);
|
||||
|
||||
channel->state = SSH_CHANNEL_STATE_OPEN;
|
||||
channel->session = NULL;
|
||||
|
||||
assert_int_equal(ssh_channel_is_open(channel), 0);
|
||||
|
||||
free(channel);
|
||||
}
|
||||
|
||||
int torture_run_tests(void) {
|
||||
int rc;
|
||||
struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(torture_channel_select),
|
||||
cmocka_unit_test(torture_channel_null_session),
|
||||
};
|
||||
|
||||
ssh_init();
|
||||
|
||||
Reference in New Issue
Block a user