1
1
libssh/tests/unittests/torture_pki.c

59 строки
1.2 KiB
C
Исходник Обычный вид История

#include "config.h"
2011-03-17 13:39:11 +03:00
#define LIBSSH_STATIC
#include <sys/stat.h>
#include <fcntl.h>
2011-03-17 13:39:11 +03:00
#include "torture.h"
#include "torture_pki.h"
2011-03-17 13:39:11 +03:00
#include "pki.c"
static void torture_pki_keytype(void **state) {
enum ssh_keytypes_e type;
const char *type_c;
(void) state; /* unused */
type = ssh_key_type(NULL);
assert_true(type == SSH_KEYTYPE_UNKNOWN);
type = ssh_key_type_from_name(NULL);
assert_true(type == SSH_KEYTYPE_UNKNOWN);
type = ssh_key_type_from_name("42");
assert_true(type == SSH_KEYTYPE_UNKNOWN);
type_c = ssh_key_type_to_char(SSH_KEYTYPE_UNKNOWN);
assert_true(type_c == NULL);
type_c = ssh_key_type_to_char(42);
assert_true(type_c == NULL);
}
2011-08-21 15:17:30 +04:00
static void torture_pki_signature(void **state)
{
ssh_signature sig;
(void) state; /* unused */
sig = ssh_signature_new();
assert_true(sig != NULL);
ssh_signature_free(sig);
}
2011-03-17 13:39:11 +03:00
int torture_run_tests(void) {
int rc;
struct CMUnitTest tests[] = {
cmocka_unit_test(torture_pki_keytype),
cmocka_unit_test(torture_pki_signature),
2011-03-17 13:39:11 +03:00
};
ssh_init();
torture_filter_tests(tests);
rc = cmocka_run_group_tests(tests, NULL, NULL);
2011-03-17 13:39:11 +03:00
ssh_finalize();
return rc;
}