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:
Greg Shue
2021-08-16 15:29:40 -07:00
committed by GitHub
parent 541f4024fb
commit 8b8ef8f338
102 changed files with 3178 additions and 1208 deletions
+3 -1
View File
@@ -53,6 +53,7 @@ void testBACnetObjects(Test *pTest)
unsigned test_point = 0;
const unsigned max_test_points = 20;
OBJECT_DEVICE_T *pDevice;
bool status = false;
for (test_point = 0; test_point < max_test_points; test_point++) {
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
@@ -74,7 +75,8 @@ void testBACnetObjects(Test *pTest)
pTest, pDevice, objects_device_id(test_point));
}
for (test_point = 0; test_point < max_test_points; test_point++) {
pDevice = objects_device_delete(0);
status = objects_device_delete(0);
ct_test(pTest, status);
}
}
+18 -11
View File
@@ -20,53 +20,60 @@
/**
* @brief Test
*/
#if 0 /*TODO: Change to use external methods */
static void testBACnetObjectsCompare(
OBJECT_DEVICE_T *pDevice, uint32_t device_id)
OBJECT_DEVICE_T *pDevice, uint32_t expected_device_id)
{
zassert_not_null(pDevice, NULL);
if (pDevice) {
zassert_not_null(pDevice->Object_List, NULL);
zassert_equal(pDevice->Object_Identifier.instance, device_id, NULL);
zassert_equal(pDevice->Object_Identifier.instance, expected_device_id, NULL);
zassert_equal(pDevice->Object_Identifier.type, OBJECT_DEVICE, NULL);
zassert_equal(pDevice->Object_Type, OBJECT_DEVICE, NULL);
}
}
#endif
static void testBACnetObjects(void)
{
#if 0 /*TODO: Change to use external methods */
uint32_t device_id = 0;
unsigned test_point = 0;
const unsigned max_test_points = 20;
OBJECT_DEVICE_T *pDevice;
/* Verify deleting a non-existant object returns the correct value */
zassert_false(objects_device_delete(0), NULL);
/* Create devices */
for (test_point = 0; test_point < max_test_points; test_point++) {
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
pDevice = objects_device_new(device_id);
testBACnetObjectsCompare(pDevice, device_id);
/* Verify the last created device can be fetched by ID */
pDevice = objects_device_by_instance(device_id);
testBACnetObjectsCompare(pDevice, device_id);
}
zassert_equal(max_test_points, objects_device_count(), NULL);
/* Verify each of the expected IDs can be fetched by ID */
for (test_point = 0; test_point < max_test_points; test_point++) {
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
pDevice = objects_device_by_instance(device_id);
testBACnetObjectsCompare(pDevice, device_id);
}
/* Verify each of the expected IDs can be fetched by index */
for (test_point = 0; test_point < max_test_points; test_point++) {
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
pDevice = objects_device_data(test_point);
testBACnetObjectsCompare(
pDevice, Keylist_Key(Device_List, test_point));
testBACnetObjectsCompare(pDevice, device_id);
}
/* Delete every object */
for (test_point = 0; test_point < max_test_points; test_point++) {
pDevice = objects_device_delete(0);
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
zassert_true(objects_device_delete(0), NULL);
zassert_equal(objects_device_by_instance(device_id), NULL, NULL);
}
#else
ztest_test_skip();
#endif
zassert_false(objects_device_delete(0), NULL);
}
/**
* @}