1
1
libssh/tests/unittests/torture_init.c
Anderson Toshiyuki Sasaki c413834764 tests: Test calling ssh_init() after ssh_finalize()
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-30 18:26:55 +01:00

47 строки
901 B
C

#include "config.h"
#define LIBSSH_STATIC
#include "torture.h"
#include "libssh/libssh.h"
static void torture_ssh_init(void **state) {
int rc;
(void) state;
rc = ssh_init();
assert_int_equal(rc, SSH_OK);
rc = ssh_finalize();
assert_int_equal(rc, SSH_OK);
}
static void torture_ssh_init_after_finalize(void **state) {
int rc;
(void) state;
rc = ssh_init();
assert_int_equal(rc, SSH_OK);
rc = ssh_finalize();
assert_int_equal(rc, SSH_OK);
rc = ssh_init();
assert_int_equal(rc, SSH_OK);
rc = ssh_finalize();
assert_int_equal(rc, SSH_OK);
}
int torture_run_tests(void) {
int rc;
struct CMUnitTest tests[] = {
cmocka_unit_test(torture_ssh_init),
cmocka_unit_test(torture_ssh_init_after_finalize),
};
torture_filter_tests(tests);
rc = cmocka_run_group_tests(tests, NULL, NULL);
return rc;
}