| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <aws/testing/aws_test_harness.h> |
| 7 |
|
| 8 |
#include <aws/io/io.h> |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
static int s_test_io_library_init(struct aws_allocator *allocator, void *ctx) { |
| 15 |
(void)allocator; |
| 16 |
(void)ctx; |
| 17 |
|
| 18 |
aws_io_library_init(allocator); |
| 19 |
aws_io_library_clean_up(); |
| 20 |
return AWS_OP_SUCCESS; |
| 21 |
} |
| 22 |
AWS_TEST_CASE(io_library_init, s_test_io_library_init) |
| 23 |
|
| 24 |
|
| 25 |
static int s_test_io_library_init_cleanup_init_cleanup(struct aws_allocator *allocator, void *ctx) { |
| 26 |
(void)allocator; |
| 27 |
(void)ctx; |
| 28 |
|
| 29 |
aws_io_library_init(allocator); |
| 30 |
aws_io_library_clean_up(); |
| 31 |
|
| 32 |
aws_io_library_init(allocator); |
| 33 |
aws_io_library_clean_up(); |
| 34 |
|
| 35 |
return AWS_OP_SUCCESS; |
| 36 |
} |
| 37 |
AWS_TEST_CASE(io_library_init_cleanup_init_cleanup, s_test_io_library_init_cleanup_init_cleanup) |
| 38 |
|
| 39 |
|
| 40 |
static int s_test_io_library_error_order(struct aws_allocator *allocator, void *ctx) { |
| 41 |
(void)allocator; |
| 42 |
(void)ctx; |
| 43 |
|
| 44 |
aws_io_library_init(allocator); |
| 45 |
|
| 46 |
|
| 47 |
int error_code_initial = 1024; |
| 48 |
int error_code_mid = 1067; |
| 49 |
int error_code_end = 1194; |
| 50 |
|
| 51 |
ASSERT_TRUE(error_code_initial == AWS_IO_CHANNEL_ERROR_ERROR_CANT_ACCEPT_INPUT); |
| 52 |
ASSERT_TRUE(error_code_mid == AWS_IO_TLS_NEGOTIATION_TIMEOUT); |
| 53 |
ASSERT_TRUE(error_code_end == AWS_IO_TLS_HOST_NAME_MISMATCH); |
| 54 |
aws_io_library_clean_up(); |
| 55 |
return AWS_OP_SUCCESS; |
| 56 |
} |
| 57 |
|
| 58 |
AWS_TEST_CASE(io_library_error_order, s_test_io_library_error_order) |