Fixed unit test compiler warnings

This commit is contained in:
Steve Karg
2024-08-06 16:19:08 -05:00
parent 1be0aa39b9
commit be65abe159
35 changed files with 143 additions and 231 deletions
+2 -24
View File
@@ -538,8 +538,6 @@ static void test_BVLC_Broadcast_Distribution_Table_Encode(void)
}
static void test_BVLC_Write_Broadcast_Distribution_Table_Message(
uint8_t *npdu,
uint16_t npdu_len,
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_list)
{
uint8_t pdu[480] = { 0 };
@@ -578,8 +576,6 @@ ZTEST(bvlc_tests, test_BVLC_Write_Broadcast_Distribution_Table)
static void test_BVLC_Write_Broadcast_Distribution_Table(void)
#endif
{
uint8_t npdu[480] = { 0 };
uint16_t npdu_len = 0;
uint16_t i = 0;
uint16_t count = 0;
uint16_t test_count = 0;
@@ -620,20 +616,10 @@ static void test_BVLC_Write_Broadcast_Distribution_Table(void)
&bdt_list[0], &bdt_list[i]);
zassert_true(status, NULL);
}
test_BVLC_Write_Broadcast_Distribution_Table_Message(
npdu, npdu_len, &bdt_list[0]);
/* now with some NPDU data */
for (i = 0; i < sizeof(npdu); i++) {
npdu[i] = i;
}
npdu_len = sizeof(npdu);
test_BVLC_Write_Broadcast_Distribution_Table_Message(
npdu, npdu_len, &bdt_list[0]);
test_BVLC_Write_Broadcast_Distribution_Table_Message(&bdt_list[0]);
}
static void test_BVLC_Read_Foreign_Device_Table_Ack_Message(
uint8_t *npdu,
uint16_t npdu_len,
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY *fdt_list)
{
uint8_t pdu[480] = { 0 };
@@ -669,8 +655,6 @@ ZTEST(bvlc_tests, test_BVLC_Read_Foreign_Device_Table_Ack)
static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
#endif
{
uint8_t npdu[480] = { 0 };
uint16_t npdu_len = 0;
uint16_t i = 0;
uint16_t count = 0;
uint16_t test_count = 0;
@@ -701,13 +685,7 @@ static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
}
test_count = bvlc_foreign_device_table_valid_count(fdt_list);
zassert_equal(test_count, count, NULL);
test_BVLC_Read_Foreign_Device_Table_Ack_Message(npdu, npdu_len, fdt_list);
/* now with some NPDU data */
for (i = 0; i < sizeof(npdu); i++) {
npdu[i] = i;
}
npdu_len = sizeof(npdu);
test_BVLC_Read_Foreign_Device_Table_Ack_Message(npdu, npdu_len, fdt_list);
test_BVLC_Read_Foreign_Device_Table_Ack_Message(fdt_list);
/* cleanup */
for (i = 0; i < count; i++) {
dest_address.port = test_port_start + i;
+17 -41
View File
@@ -103,7 +103,10 @@ uint16_t MSTP_Put_Receive(struct mstp_port_struct_t *mstp_port)
* @return amount of PDU data
*/
uint16_t MSTP_Get_Send(struct mstp_port_struct_t *mstp_port, unsigned timeout)
{ /* milliseconds to wait for a packet */
{
(void)mstp_port;
(void)timeout;
return 0;
}
@@ -114,7 +117,10 @@ uint16_t MSTP_Get_Send(struct mstp_port_struct_t *mstp_port, unsigned timeout)
* @return amount of PDU data
*/
uint16_t MSTP_Get_Reply(struct mstp_port_struct_t *mstp_port, unsigned timeout)
{ /* milliseconds to wait for a packet */
{
(void)mstp_port;
(void)timeout;
return 0;
}
@@ -593,8 +599,6 @@ static void testMasterNodeFSM(void)
static void testSlaveNodeFSM(void)
{
struct mstp_port_struct_t MSTP_Port = { 0 }; /* port data */
bool transition_now, non_zero;
unsigned slots, silence, i;
MSTP_Port.InputBuffer = &RxBuffer[0];
MSTP_Port.InputBufferSize = sizeof(RxBuffer);
@@ -677,8 +681,7 @@ static void testZeroConfigNode_Init(struct mstp_port_struct_t *mstp_port)
static void
testZeroConfigNode_No_Events_Timeout(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
SilenceTime = mstp_port->Zero_Config_Silence + 1;
transition_now = MSTP_Master_Node_FSM(mstp_port);
@@ -690,8 +693,7 @@ testZeroConfigNode_No_Events_Timeout(struct mstp_port_struct_t *mstp_port)
static void testZeroConfigNode_Test_Request_Unsupported(
struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
/* test case: remote node does not support Test-Request; timeout */
SilenceTime = mstp_port->Treply_timeout + 1;
@@ -703,31 +705,10 @@ static void testZeroConfigNode_Test_Request_Unsupported(
mstp_port->This_Station == mstp_port->Zero_Config_Station, NULL);
}
static void
testZeroConfigNode_Test_Request_Supported(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
/* test case: remote node supports Test-Request */
SilenceTime = 0;
mstp_port->DestinationAddress = mstp_port->Zero_Config_Station;
mstp_port->SourceAddress = 0;
mstp_port->FrameType = FRAME_TYPE_TEST_RESPONSE;
transition_now = MSTP_Master_Node_FSM(mstp_port);
zassert_true(transition_now, NULL);
zassert_true(
mstp_port->Zero_Config_State == MSTP_ZERO_CONFIG_STATE_USE, NULL);
zassert_true(
mstp_port->This_Station == mstp_port->Zero_Config_Station, NULL);
}
static void
testZeroConfigNode_Test_IDLE_InvalidFrame(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
/* test case: waiting for a invalid frame */
SilenceTime = 0;
@@ -747,8 +728,7 @@ testZeroConfigNode_Test_IDLE_InvalidFrame(struct mstp_port_struct_t *mstp_port)
static void testZeroConfigNode_Test_IDLE_ValidFrameTimeout(
struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
/* test case: get a valid frame, followed by timeout */
SilenceTime = 0;
@@ -775,8 +755,7 @@ static void testZeroConfigNode_Test_IDLE_ValidFrameTimeout(
static void
testZeroConfigNode_Test_IDLE_ValidFrame(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
/* test case: get a valid frame, followed by timeout */
SilenceTime = 0;
@@ -793,8 +772,7 @@ testZeroConfigNode_Test_IDLE_ValidFrame(struct mstp_port_struct_t *mstp_port)
static void
testZeroConfigNode_Test_LURK_AddressInUse(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
uint8_t src, dst;
/* test case: src emits a token from each MAC in the zero-config range */
@@ -820,9 +798,8 @@ testZeroConfigNode_Test_LURK_AddressInUse(struct mstp_port_struct_t *mstp_port)
static void testZeroConfigNode_Test_LURK_LearnMaxMaster(
struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
uint8_t src, dst;
bool transition_now;
uint8_t dst;
/* test case: src emits a token from each MAC in the zero-config range */
SilenceTime = 0;
@@ -843,8 +820,7 @@ static void testZeroConfigNode_Test_LURK_LearnMaxMaster(
static void
testZeroConfigNode_Test_LURK_Claim(struct mstp_port_struct_t *mstp_port)
{
bool transition_now, non_zero;
unsigned slots, silence, i;
bool transition_now;
uint8_t src = 0, dst, count, count_max, count_claim;
/* test case: src emits a PFM from each MAC in the zero-config range */