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:
Steve Karg
2024-08-28 16:21:58 -05:00
committed by GitHub
parent b3c8c10c03
commit 3d3e192ae9
86 changed files with 872 additions and 87 deletions
+11
View File
@@ -38,6 +38,8 @@ static void testLightingOutput(void)
bool status = false;
unsigned index;
uint16_t milliseconds = 10;
const char *test_name = NULL;
char *sample_name = "sample";
Lighting_Output_Init();
Lighting_Output_Create(instance);
@@ -131,6 +133,15 @@ static void testLightingOutput(void)
zassert_false(status, NULL);
/* check the dimming/ramping/stepping engine*/
Lighting_Output_Timer(instance, milliseconds);
/* test the ASCII name get/set */
status = Lighting_Output_Name_Set(instance, sample_name);
zassert_true(status, NULL);
test_name = Lighting_Output_Name_ASCII(instance);
zassert_equal(test_name, sample_name, NULL);
status = Lighting_Output_Name_Set(instance, NULL);
zassert_true(status, NULL);
test_name = Lighting_Output_Name_ASCII(instance);
zassert_equal(test_name, NULL, NULL);
/* check the delete function */
status = Lighting_Output_Delete(instance);
zassert_true(status, NULL);