Issue 187 enable skipped ztest suites (#189)
* Fix some ztests that were skipped * Expose bacapp_same_value() * Fix bacapp, ptransfer tests * Fix bugs in Load_Control object & tests * refactor days functions from datetime module * fix legacy ctests * Add bacnet/basic/sys/days.[ch] to Zephyr build * Update ztest to match from Zephyr v2.6.0; update ringbuf, datetime to build * Fixup ztest test for object/acc * Fix bvlc_address_from_ascii; enable/fix bvlc test * Comment cleanup * test/bacnet/basic/object/lc partially enabled * Fix bacapp_decode_data_len return status on erroneous input * fix ztest include fatal error * fix ztest strsignal reference fatal error * fix zassert_mem_equal reference syntax error * fix zassert_mem_equal reference syntax error Co-authored-by: Gregory Shue <gregory.shue@legrand.us> Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -39,6 +39,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/bacreal.c
|
||||
${SRC_DIR}/bacnet/bacstr.c
|
||||
${SRC_DIR}/bacnet/basic/sys/bigend.c
|
||||
${SRC_DIR}/bacnet/basic/sys/days.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -20,16 +20,13 @@
|
||||
/**
|
||||
* @brief Test
|
||||
*/
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Address(
|
||||
BACNET_IP_ADDRESS *bip_address_1,
|
||||
BACNET_IP_ADDRESS *bip_address_2)
|
||||
{
|
||||
zassert_false(bvlc_address_different(bip_address_1, bip_address_2), NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Broadcast_Distribution_Mask(
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_MASK *bd_mask_1,
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_MASK *bd_mask_2)
|
||||
@@ -37,9 +34,7 @@ static void test_BVLC_Broadcast_Distribution_Mask(
|
||||
zassert_false(
|
||||
bvlc_broadcast_distribution_mask_different(bd_mask_1, bd_mask_2), NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Broadcast_Distribution_Table_Entry(
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_entry_1,
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_entry_2)
|
||||
@@ -54,9 +49,7 @@ static void test_BVLC_Broadcast_Distribution_Table_Entry(
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Foreign_Device_Table_Entry(
|
||||
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY *fdt_entry_1,
|
||||
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY *fdt_entry_2)
|
||||
@@ -73,9 +66,7 @@ static void test_BVLC_Foreign_Device_Table_Entry(
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static int test_BVLC_Header(
|
||||
uint8_t *pdu,
|
||||
uint16_t pdu_len,
|
||||
@@ -94,9 +85,7 @@ static int test_BVLC_Header(
|
||||
|
||||
return bytes_consumed;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Result_Code(uint16_t result_code)
|
||||
{
|
||||
uint8_t pdu[50] = { 0 };
|
||||
@@ -115,11 +104,9 @@ static void test_BVLC_Result_Code(uint16_t result_code)
|
||||
zassert_equal(len, test_len, NULL);
|
||||
zassert_equal(result_code, test_result_code, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Result(void)
|
||||
{
|
||||
#if 0 /*TODO: refactor */
|
||||
uint16_t result_code[] = { BVLC_RESULT_SUCCESSFUL_COMPLETION,
|
||||
BVLC_RESULT_WRITE_BROADCAST_DISTRIBUTION_TABLE_NAK,
|
||||
BVLC_RESULT_READ_BROADCAST_DISTRIBUTION_TABLE_NAK,
|
||||
@@ -133,12 +120,8 @@ static void test_BVLC_Result(void)
|
||||
for (i = 0; i < result_code_max; i++) {
|
||||
test_BVLC_Result_Code(result_code[i]);
|
||||
}
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Original_Unicast_NPDU_Message(
|
||||
uint8_t *npdu, uint16_t npdu_len)
|
||||
{
|
||||
@@ -166,11 +149,9 @@ static void test_BVLC_Original_Unicast_NPDU_Message(
|
||||
zassert_equal(npdu[i], test_npdu[i], NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Original_Unicast_NPDU(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[50] = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -182,12 +163,8 @@ static void test_BVLC_Original_Unicast_NPDU(void)
|
||||
}
|
||||
npdu_len = sizeof(npdu);
|
||||
test_BVLC_Original_Unicast_NPDU_Message(npdu, npdu_len);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Original_Broadcast_NPDU_Message(
|
||||
uint8_t *npdu, uint16_t npdu_len)
|
||||
{
|
||||
@@ -215,11 +192,9 @@ static void test_BVLC_Original_Broadcast_NPDU_Message(
|
||||
zassert_equal(npdu[i], test_npdu[i], NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Original_Broadcast_NPDU(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[50] = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -231,12 +206,8 @@ static void test_BVLC_Original_Broadcast_NPDU(void)
|
||||
}
|
||||
npdu_len = sizeof(npdu);
|
||||
test_BVLC_Original_Broadcast_NPDU_Message(npdu, npdu_len);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Forwarded_NPDU_Message(
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len,
|
||||
@@ -269,11 +240,9 @@ static void test_BVLC_Forwarded_NPDU_Message(
|
||||
zassert_equal(npdu[i], test_npdu[i], NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Forwarded_NPDU(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[50] = { 0 };
|
||||
BACNET_IP_ADDRESS bip_address = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
@@ -290,12 +259,8 @@ static void test_BVLC_Forwarded_NPDU(void)
|
||||
}
|
||||
npdu_len = sizeof(npdu);
|
||||
test_BVLC_Forwarded_NPDU_Message(npdu, npdu_len, &bip_address);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Register_Foreign_Device_Message(
|
||||
uint16_t ttl_seconds)
|
||||
{
|
||||
@@ -318,22 +283,16 @@ static void test_BVLC_Register_Foreign_Device_Message(
|
||||
zassert_equal(msg_len, test_len, NULL);
|
||||
zassert_equal(ttl_seconds, test_ttl_seconds, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Register_Foreign_Device(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint16_t ttl_seconds = 0;
|
||||
|
||||
test_BVLC_Register_Foreign_Device_Message(ttl_seconds);
|
||||
ttl_seconds = 600;
|
||||
test_BVLC_Register_Foreign_Device_Message(ttl_seconds);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Delete_Foreign_Device_Message(
|
||||
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY *fdt_entry)
|
||||
{
|
||||
@@ -361,11 +320,9 @@ static void test_BVLC_Delete_Foreign_Device_Message(
|
||||
test_BVLC_Address(
|
||||
&fdt_entry->dest_address, &test_fdt_entry.dest_address);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Delete_Foreign_Device(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY fdt_entry = { 0 };
|
||||
unsigned int i = 0;
|
||||
|
||||
@@ -380,12 +337,8 @@ static void test_BVLC_Delete_Foreign_Device(void)
|
||||
fdt_entry.ttl_seconds_remaining = 42;
|
||||
fdt_entry.next = NULL;
|
||||
test_BVLC_Delete_Foreign_Device_Message(&fdt_entry);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Secure_BVLL_Message(
|
||||
uint8_t *sbuf, uint16_t sbuf_len)
|
||||
{
|
||||
@@ -413,11 +366,9 @@ static void test_BVLC_Secure_BVLL_Message(
|
||||
zassert_equal(sbuf[i], test_sbuf[i], NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Secure_BVLL(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t sbuf[50] = { 0 };
|
||||
uint16_t sbuf_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -429,14 +380,10 @@ static void test_BVLC_Secure_BVLL(void)
|
||||
}
|
||||
sbuf_len = sizeof(sbuf);
|
||||
test_BVLC_Secure_BVLL_Message(sbuf, sbuf_len);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_BVLC_Read_Broadcast_Distribution_Table_Message(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t pdu[60] = { 0 };
|
||||
uint8_t message_type = 0;
|
||||
uint16_t length = 0;
|
||||
@@ -449,12 +396,8 @@ static void test_BVLC_Read_Broadcast_Distribution_Table_Message(void)
|
||||
zassert_equal(test_len, 4, NULL);
|
||||
zassert_equal(message_type, BVLC_READ_BROADCAST_DIST_TABLE, NULL);
|
||||
zassert_equal(length, msg_len, NULL);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Distribute_Broadcast_To_Network_Message(
|
||||
uint8_t *npdu, uint16_t npdu_len)
|
||||
{
|
||||
@@ -483,11 +426,9 @@ static void test_BVLC_Distribute_Broadcast_To_Network_Message(
|
||||
zassert_equal(npdu[i], test_npdu[i], NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Distribute_Broadcast_To_Network(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[50] = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -499,9 +440,6 @@ static void test_BVLC_Distribute_Broadcast_To_Network(void)
|
||||
}
|
||||
npdu_len = sizeof(npdu);
|
||||
test_BVLC_Distribute_Broadcast_To_Network_Message(npdu, npdu_len);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_BVLC_Broadcast_Distribution_Table_Encode(void)
|
||||
@@ -561,7 +499,6 @@ static void test_BVLC_Broadcast_Distribution_Table_Encode(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Write_Broadcast_Distribution_Table_Message(
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len,
|
||||
@@ -596,11 +533,9 @@ static void test_BVLC_Write_Broadcast_Distribution_Table_Message(
|
||||
&bdt_list[i], &test_bdt_list[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Write_Broadcast_Distribution_Table(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[480] = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -652,12 +587,8 @@ static void test_BVLC_Write_Broadcast_Distribution_Table(void)
|
||||
npdu_len = sizeof(npdu);
|
||||
test_BVLC_Write_Broadcast_Distribution_Table_Message(
|
||||
npdu, npdu_len, &bdt_list[0]);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
static void test_BVLC_Read_Foreign_Device_Table_Ack_Message(
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len,
|
||||
@@ -690,11 +621,9 @@ static void test_BVLC_Read_Foreign_Device_Table_Ack_Message(
|
||||
&fdt_list[i], &test_fdt_list[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint8_t npdu[480] = { 0 };
|
||||
uint16_t npdu_len = 0;
|
||||
uint16_t i = 0;
|
||||
@@ -745,14 +674,10 @@ static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
|
||||
}
|
||||
test_count = bvlc_foreign_device_table_valid_count(fdt_list);
|
||||
zassert_equal(test_count, 0, NULL);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_BVLC_Address_Copy(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
unsigned int i = 0;
|
||||
BACNET_IP_ADDRESS src = { 0 };
|
||||
BACNET_IP_ADDRESS dst = { 0 };
|
||||
@@ -784,14 +709,10 @@ static void test_BVLC_Address_Copy(void)
|
||||
zassert_true(status, NULL);
|
||||
dst.address[i] = 1 + i;
|
||||
}
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_BVLC_Address_Get_Set(void)
|
||||
{
|
||||
#if 0 /*TODO: Expose test_BVLC_Header */
|
||||
uint16_t i = 0;
|
||||
BACNET_ADDRESS bsrc = { 0 };
|
||||
BACNET_IP_ADDRESS src = { 0 };
|
||||
@@ -893,10 +814,8 @@ static void test_BVLC_Address_Get_Set(void)
|
||||
zassert_equal(octet1, test_octet1, NULL);
|
||||
zassert_equal(octet2, test_octet2, NULL);
|
||||
zassert_equal(octet3, test_octet3, NULL);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -913,6 +832,7 @@ void test_main(void)
|
||||
ztest_unit_test(test_BVLC_Read_Foreign_Device_Table_Ack),
|
||||
ztest_unit_test(test_BVLC_Delete_Foreign_Device),
|
||||
ztest_unit_test(test_BVLC_Distribute_Broadcast_To_Network),
|
||||
ztest_unit_test(test_BVLC_Broadcast_Distribution_Table_Encode),
|
||||
ztest_unit_test(test_BVLC_Original_Unicast_NPDU),
|
||||
ztest_unit_test(test_BVLC_Original_Broadcast_NPDU),
|
||||
ztest_unit_test(test_BVLC_Secure_BVLL),
|
||||
|
||||
Reference in New Issue
Block a user