Imported OpenSSL 1.1.1d
This commit is contained in:
@@ -181,6 +181,45 @@ finish:
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int test_bio_nonclear_rst(void)
|
||||
{
|
||||
int ok = 0;
|
||||
BIO *bio = NULL;
|
||||
char data[16];
|
||||
|
||||
bio = BIO_new(BIO_s_mem());
|
||||
if (!TEST_ptr(bio))
|
||||
goto finish;
|
||||
if (!TEST_int_eq(BIO_puts(bio, "Hello World\n"), 12))
|
||||
goto finish;
|
||||
|
||||
BIO_set_flags(bio, BIO_FLAGS_NONCLEAR_RST);
|
||||
|
||||
if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
|
||||
goto finish;
|
||||
if (!TEST_mem_eq(data, 12, "Hello World\n", 12))
|
||||
goto finish;
|
||||
if (!TEST_int_gt(BIO_reset(bio), 0))
|
||||
goto finish;
|
||||
|
||||
if (!TEST_int_eq(BIO_read(bio, data, 16), 12))
|
||||
goto finish;
|
||||
if (!TEST_mem_eq(data, 12, "Hello World\n", 12))
|
||||
goto finish;
|
||||
|
||||
BIO_clear_flags(bio, BIO_FLAGS_NONCLEAR_RST);
|
||||
if (!TEST_int_gt(BIO_reset(bio), 0))
|
||||
goto finish;
|
||||
|
||||
if (!TEST_int_lt(BIO_read(bio, data, 16), 1))
|
||||
goto finish;
|
||||
|
||||
ok = 1;
|
||||
|
||||
finish:
|
||||
BIO_free(bio);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int global_init(void)
|
||||
{
|
||||
@@ -196,5 +235,6 @@ int setup_tests(void)
|
||||
ADD_TEST(test_bio_new_mem_buf);
|
||||
ADD_TEST(test_bio_rdonly_mem_buf);
|
||||
ADD_TEST(test_bio_rdwr_rdonly);
|
||||
ADD_TEST(test_bio_nonclear_rst);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user