ced9dff0f2
* Added AddListElement and RemoveListElement services Added list-element codec and unit tests. Added BACnetDestination codec and unit tests. Added RecipientList handling to NotificationClass object. Added AddListElement and RemoveListElement client example app. * Fix defects found by scan-build and CPPCHECK * Update ports errors found during CI builds * Update zephy os test build missing files in CMakeLists --------- Co-authored-by: Ondřej Hruška <ondra@ondrovo.com> Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
/**
|
|
* @file
|
|
* @brief Unit test for object
|
|
* @author Steve Karg <skarg@users.sourceforge.net>
|
|
* @date December 2022
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
#include <ztest.h>
|
|
#include <bacnet/bactext.h>
|
|
#include <bacnet/rp.h>
|
|
#include <bacnet/basic/object/nc.h>
|
|
|
|
/**
|
|
* @addtogroup bacnet_tests
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief Test
|
|
*/
|
|
static void test_Notification_Class(void)
|
|
{
|
|
BACNET_READ_PROPERTY_DATA rpdata;
|
|
uint8_t apdu[MAX_APDU] = { 0 };
|
|
int len = 0;
|
|
uint32_t len_value = 0;
|
|
uint8_t tag_number = 0;
|
|
BACNET_OBJECT_TYPE decoded_type = 0;
|
|
uint32_t decoded_instance = 0;
|
|
|
|
Notification_Class_Init();
|
|
rpdata.application_data = &apdu[0];
|
|
rpdata.application_data_len = sizeof(apdu);
|
|
rpdata.object_type = OBJECT_NOTIFICATION_CLASS;
|
|
rpdata.object_instance = 1;
|
|
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
|
rpdata.array_index = BACNET_ARRAY_ALL;
|
|
len = Notification_Class_Read_Property(&rpdata);
|
|
zassert_not_equal(len, 0, NULL);
|
|
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
|
zassert_equal(tag_number, BACNET_APPLICATION_TAG_OBJECT_ID, NULL);
|
|
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
|
zassert_equal(decoded_type, rpdata.object_type, NULL);
|
|
zassert_equal(decoded_instance, rpdata.object_instance, NULL);
|
|
|
|
return;
|
|
}
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
|
|
void test_main(void)
|
|
{
|
|
ztest_test_suite(notification_class_tests,
|
|
ztest_unit_test(test_Notification_Class)
|
|
);
|
|
|
|
ztest_run_test_suite(notification_class_tests);
|
|
}
|