31 lines
945 B
C
31 lines
945 B
C
#include "c_Test.h"
|
|
#include "c_TcpClient.h"
|
|
#include <string.h>
|
|
|
|
TEST_CASE(test_raw_stream_free_client_lifecycle) {
|
|
c_Socket_Init();
|
|
c_TcpClient_t client=C_TCPCLIENT_INITIALIZE;
|
|
|
|
/* Connect operation should gracefully fail on an unbound dead port */
|
|
c_err_t err = c_TcpClient_Connect(&client, AF_INET, "127.0.0.1", "9999", 0, NULL);
|
|
ASSERT_INT_EQ(C_ERR_FAIL, err);
|
|
ASSERT_FALSE(client.is_linked);
|
|
ASSERT_FALSE(c_Socket_IsValid(client.sock));
|
|
|
|
/* Raw Send operations must catch parameter unassigned states safely */
|
|
c_size_t sent = 0;
|
|
err = c_TcpClient_Send(&client, "DATA", 4, &sent);
|
|
ASSERT_INT_EQ(C_ERR_PARAM, err);
|
|
|
|
/* Execute explicit structure cleanup safety tests */
|
|
c_TcpClient_Destroy(&client);
|
|
c_Socket_Destroy();
|
|
}
|
|
|
|
int main(void) {
|
|
TEST_START(TcpClient_RawStreamFree_Suite);
|
|
RUN_TEST(test_raw_stream_free_client_lifecycle);
|
|
TEST_REPORT();
|
|
RETURN_TEST_STATUS;
|
|
}
|