Skip to content

Commit

Permalink
Modified test_FreeRTOS_FindEndPointOnIP_IPv4_ZeroAddressEndpoint()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlfaSegato committed Sep 12, 2024
1 parent e6d6012 commit 7b835ea
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/unit-test/FreeRTOS_Routing/FreeRTOS_Routing_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,25 +1440,33 @@ void test_FreeRTOS_FindEndPointOnIP_IPv4_AnyEndpoint( void )
* pxNetworkEndPoints is a global variable using in FreeRTOS_Routing as link list head of all endpoints.
*
* Test step:
* - Create 1 endpoint with IP address 0 and add it to the list.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_ADDRESS.
* - Create 1 endpoint with IP address 0xAB12CD34 and add it to the list.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with 0xAB12CD34.
* - Check if returned endpoint is same.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_GATEWAY.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with 0.
* - Check if returned endpoint is same.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_ADDRESS.
* - Check if returned endpoint is NULL.
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_GATEWAY.
* - Check if returned endpoint is NULL.
*/
void test_FreeRTOS_FindEndPointOnIP_IPv4_ZeroAddressEndpoint( void )
{
NetworkEndPoint_t xEndPoint;
NetworkEndPoint_t * pxEndPoint = NULL;

memset( &xEndPoint, 0, sizeof( NetworkEndPoint_t ) );
xEndPoint.ipv4_settings.ulIPAddress = 0;
xEndPoint.ipv4_settings.ulIPAddress = 0xAB12CD34;
pxNetworkEndPoints = &xEndPoint;

pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_ADDRESS );
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( 0xAB12CD34 );
TEST_ASSERT_EQUAL( &xEndPoint, pxEndPoint );
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_GATEWAY );
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( 0 );
TEST_ASSERT_EQUAL( &xEndPoint, pxEndPoint );
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_ADDRESS );
TEST_ASSERT_EQUAL( NULL, pxEndPoint );
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_GATEWAY );
TEST_ASSERT_EQUAL( NULL, pxEndPoint );
}

/**
Expand Down

0 comments on commit 7b835ea

Please sign in to comment.