Skip to content

Commit

Permalink
Fix UT coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
moninom1 committed Dec 1, 2023
1 parent 3a37a74 commit 80e2cc7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,10 @@ void test_FreeRTOS_get_tx_base_InvalidParams( void )
xSocket.ucProtocol = FREERTOS_IPPROTO_TCP;
pucReturn = FreeRTOS_get_tx_base( &xSocket );
TEST_ASSERT_EQUAL( NULL, pucReturn );

xSocket.u.xTCP.bits.bMallocError == pdTRUE_UNSIGNED;
pucReturn = FreeRTOS_get_tx_base( &xSocket );
TEST_ASSERT_EQUAL( NULL, pucReturn );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ void test_vSocketBind_TCP( void )
/**
* @brief Address passed is NULL.
*/
void test_vSocketBind_TCPNULLAddress( void )
void test_vSocketBind_TCPNULLAddress_v4( void )
{
BaseType_t xReturn;
FreeRTOS_Socket_t xSocket;
Expand All @@ -603,6 +603,30 @@ void test_vSocketBind_TCPNULLAddress( void )
memset( &xSocket, 0, sizeof( xSocket ) );

xSocket.ucProtocol = ( uint8_t ) FREERTOS_IPPROTO_TCP;
xSocket.bits.bIsIPv6 = 0;

xApplicationGetRandomNumber_ExpectAnyArgsAndReturn( pdFALSE );
xReturn = vSocketBind( &xSocket, NULL, uxAddressLength, xInternal );

TEST_ASSERT_EQUAL( -pdFREERTOS_ERRNO_EADDRNOTAVAIL, xReturn );
}

/**
* @brief Address passed is NULL.
*/
void test_vSocketBind_TCPNULLAddress_v6( void )
{
BaseType_t xReturn;
FreeRTOS_Socket_t xSocket;
struct freertos_sockaddr xBindAddress;
size_t uxAddressLength;
BaseType_t xInternal = pdFALSE;

memset( &xBindAddress, 0xFC, sizeof( xBindAddress ) );
memset( &xSocket, 0, sizeof( xSocket ) );

xSocket.ucProtocol = ( uint8_t ) FREERTOS_IPPROTO_TCP;
xSocket.bits.bIsIPv6 = 1;

xApplicationGetRandomNumber_ExpectAnyArgsAndReturn( pdFALSE );
xReturn = vSocketBind( &xSocket, NULL, uxAddressLength, xInternal );
Expand Down

0 comments on commit 80e2cc7

Please sign in to comment.