Added object-name c-string getter function to basic objects so they can be referenced to free if dynamically created. (#754)
* Added basic object-name get for ASCII names to enable free if they were dynamically created. Added unit testing to validate the basic object ASCII object-name API. * Removed static scope on character array used for name since the array gets copied into characterstring array and static is not needed.
This commit is contained in:
@@ -36,6 +36,8 @@ static void testBinaryLightingOutput(void)
|
||||
uint32_t test_instance = 0;
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Binary_Lighting_Output_Init();
|
||||
test_instance = Binary_Lighting_Output_Create(instance);
|
||||
@@ -129,6 +131,15 @@ static void testBinaryLightingOutput(void)
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
status = Binary_Lighting_Output_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Binary_Lighting_Output_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Binary_Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Binary_Lighting_Output_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Binary_Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* check the delete function */
|
||||
status = Binary_Lighting_Output_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
Reference in New Issue
Block a user