35 lines
901 B
C
35 lines
901 B
C
#include "test_transport_ssh.h"
|
|
#include "transport_ssh.h"
|
|
#include "transport_tcp.h"
|
|
#include "test_utils.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
static void test_ssh_connect_bad_destination() {
|
|
Client* client = client_connect_ssh("nosuchhost.local", 22);
|
|
// SSH connection to a non-existent host should fail (return NULL)
|
|
EXPECT_NULL(client);
|
|
}
|
|
|
|
static void test_ssh_connect_null_destination() {
|
|
Client* client = client_connect_ssh(NULL, 22);
|
|
EXPECT_NULL(client);
|
|
}
|
|
|
|
static void test_ssh_connect_bad_port() {
|
|
Client* client = client_connect_ssh("localhost", -1);
|
|
EXPECT_NULL(client);
|
|
}
|
|
|
|
static void test_ssh_connect_zero_port() {
|
|
Client* client = client_connect_ssh("localhost", 0);
|
|
EXPECT_NULL(client);
|
|
}
|
|
|
|
void test_transport_ssh() {
|
|
test_ssh_connect_bad_destination();
|
|
test_ssh_connect_null_destination();
|
|
test_ssh_connect_bad_port();
|
|
test_ssh_connect_zero_port();
|
|
}
|