Issue 87 execute tests with GitHub ci (#234)
* Enable lcov coverage in unit testing via cmake. * fix pipeline build error * add compile options for unit test to silence some warnings * remove all BAC_TEST unit tests in src/bacnet/ folder. They are now in test/bacnet/ folders using ztest. * removed key.c - only used for unit test. * produce XML test result output for parsing * produce junit XML test result output * change lint workflow to quality * update readme badge for quality results Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -127,13 +127,6 @@ extern "C" {
|
||||
void Access_Credential_Init(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testAccessCredential(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -163,13 +163,6 @@ extern "C" {
|
||||
void Binary_Output_Cleanup(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testBinaryOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -538,57 +538,3 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testBinary_Value(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Binary_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_BINARY_VALUE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Binary_Value_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_BINARY_VALUE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Binary_Value", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testBinary_Value);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_BINARY_VALUE */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -181,13 +181,6 @@ extern "C" {
|
||||
void Binary_Value_Cleanup(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testBinary_Value(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -222,12 +222,6 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
void Channel_Init(void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testChannelObject(Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -820,88 +820,3 @@ bool Command_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
void Command_Intrinsic_Reporting(uint32_t object_instance)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testCommand(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
BACNET_ACTION_LIST clist, clist_test;
|
||||
Command_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_COMMAND;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Command_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
memset(&clist, 0, sizeof(BACNET_ACTION_LIST));
|
||||
memset(&clist_test, 0, sizeof(BACNET_ACTION_LIST));
|
||||
clist.Device_Id.type = OBJECT_DEVICE;
|
||||
clist.Device_Id.instance = 3389;
|
||||
clist.Object_Id.type = OBJECT_ANALOG_VALUE;
|
||||
clist.Object_Id.instance = 42;
|
||||
clist.Property_Identifier = PROP_PRESENT_VALUE;
|
||||
clist.Property_Array_Index = BACNET_ARRAY_ALL;
|
||||
clist.Value.tag = BACNET_APPLICATION_TAG_REAL;
|
||||
clist.Value.type.Real = 39.0f;
|
||||
clist.Priority = 4;
|
||||
clist.Post_Delay = 0xFFFFFFFFU;
|
||||
clist.Quit_On_Failure = true;
|
||||
clist.Write_Successful = false;
|
||||
clist.next = NULL;
|
||||
len = cl_encode_apdu(apdu, &clist);
|
||||
ct_test(pTest, len > 0);
|
||||
len = cl_decode_apdu(apdu, len, BACNET_APPLICATION_TAG_REAL, &clist_test);
|
||||
ct_test(pTest, len > 0);
|
||||
ct_test(pTest, clist.Device_Id.type == clist_test.Device_Id.type);
|
||||
ct_test(pTest, clist.Device_Id.instance == clist_test.Device_Id.instance);
|
||||
ct_test(pTest, clist.Object_Id.type == clist_test.Object_Id.type);
|
||||
ct_test(pTest, clist.Object_Id.instance == clist_test.Object_Id.instance);
|
||||
ct_test(pTest, clist.Property_Identifier == clist_test.Property_Identifier);
|
||||
ct_test(
|
||||
pTest, clist.Property_Array_Index == clist_test.Property_Array_Index);
|
||||
ct_test(pTest, clist.Value.tag == clist_test.Value.tag);
|
||||
ct_test(pTest, clist.Value.type.Real == clist_test.Value.type.Real);
|
||||
ct_test(pTest, clist.Priority == clist_test.Priority);
|
||||
ct_test(pTest, clist.Post_Delay == clist_test.Post_Delay);
|
||||
ct_test(pTest, clist.Quit_On_Failure == clist_test.Quit_On_Failure);
|
||||
ct_test(pTest, clist.Write_Successful == clist_test.Write_Successful);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_COMMAND
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Command", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testCommand);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_COMMAND */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -188,13 +188,6 @@ extern "C" {
|
||||
void Command_Init(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testCommand(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -362,57 +362,3 @@ bool Credential_Data_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testCredentialDataInput(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Credential_Data_Input_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_CREDENTIAL_DATA_INPUT;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Credential_Data_Input_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_CREDENTIAL_DATA_INPUT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Credential Data Input", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testCredentialDataInput);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_CREDENTIAL_DATA_INPUT */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -121,13 +121,6 @@ extern "C" {
|
||||
void Credential_Data_Input_Init(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testCredentialDataInput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -625,57 +625,3 @@ bool CharacterString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testCharacterStringValue(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
CharacterString_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_CHARACTERSTRING_VALUE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = CharacterString_Value_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_CHARACTERSTRING_VALUE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet CharacterString Value", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testCharacterStringValue);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -109,14 +109,6 @@ extern "C" {
|
||||
void CharacterString_Value_Init(
|
||||
void);
|
||||
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testCharacterStringValue(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -1890,104 +1890,3 @@ void Routing_Device_Init(uint32_t first_object_instance)
|
||||
}
|
||||
|
||||
#endif /* BAC_ROUTING */
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool write_property_type_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
uint8_t expected_tag)
|
||||
{
|
||||
(void)wp_data;
|
||||
(void)value;
|
||||
(void)expected_tag;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool write_property_string_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
int len_max)
|
||||
{
|
||||
(void)wp_data;
|
||||
(void)value;
|
||||
(void)len_max;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool write_property_empty_string_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
int len_max)
|
||||
{
|
||||
(void)wp_data;
|
||||
(void)value;
|
||||
(void)len_max;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int handler_cov_encode_subscriptions(uint8_t *apdu, int max_apdu)
|
||||
{
|
||||
apdu = apdu;
|
||||
max_apdu = max_apdu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void testDevice(Test *pTest)
|
||||
{
|
||||
bool status = false;
|
||||
const char *name = "Patricia";
|
||||
|
||||
status = Device_Set_Object_Instance_Number(0);
|
||||
ct_test(pTest, Device_Object_Instance_Number() == 0);
|
||||
ct_test(pTest, status == true);
|
||||
status = Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
|
||||
ct_test(pTest, Device_Object_Instance_Number() == BACNET_MAX_INSTANCE);
|
||||
ct_test(pTest, status == true);
|
||||
status = Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE / 2);
|
||||
ct_test(
|
||||
pTest, Device_Object_Instance_Number() == (BACNET_MAX_INSTANCE / 2));
|
||||
ct_test(pTest, status == true);
|
||||
status = Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE + 1);
|
||||
ct_test(
|
||||
pTest, Device_Object_Instance_Number() != (BACNET_MAX_INSTANCE + 1));
|
||||
ct_test(pTest, status == false);
|
||||
|
||||
Device_Set_System_Status(STATUS_NON_OPERATIONAL, true);
|
||||
ct_test(pTest, Device_System_Status() == STATUS_NON_OPERATIONAL);
|
||||
|
||||
ct_test(pTest, Device_Vendor_Identifier() == BACNET_VENDOR_ID);
|
||||
|
||||
Device_Set_Model_Name(name, strlen(name));
|
||||
ct_test(pTest, strcmp(Device_Model_Name(), name) == 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_DEVICE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Device", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testDevice);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_DEVICE */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -131,13 +131,6 @@ extern "C" {
|
||||
void Integer_Value_Init(
|
||||
void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testInteger_Value(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -868,7 +868,7 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
int len = 0;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
/* build here in case of error in time half of datetime */
|
||||
BACNET_DATE start_date;
|
||||
BACNET_DATE start_date;
|
||||
|
||||
PRINTF("Load_Control_Write_Property(wp_data=%p)\n", wp_data);
|
||||
if (wp_data == NULL) {
|
||||
@@ -1036,417 +1036,3 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
PRINTF("Load_Control_Write_Property() returning status=%d\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
#if 0
|
||||
static void Load_Control_WriteProperty_Request_Shed_Percent(
|
||||
Test * pTest,
|
||||
int instance,
|
||||
unsigned percent)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_REQUESTED_SHED_LEVEL;
|
||||
wp_data.error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data.error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||
value.context_specific = true;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT;
|
||||
value.type.Unsigned_Int = percent;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Load_Control_WriteProperty_Request_Shed_Level(
|
||||
Test *pTest, int instance, unsigned level)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_REQUESTED_SHED_LEVEL;
|
||||
value.context_specific = true;
|
||||
value.context_tag = 1;
|
||||
value.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT;
|
||||
value.type.Unsigned_Int = level;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void Load_Control_WriteProperty_Request_Shed_Amount(
|
||||
Test * pTest,
|
||||
int instance,
|
||||
float amount)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_REQUESTED_SHED_LEVEL;
|
||||
value.context_specific = true;
|
||||
value.context_tag = 2;
|
||||
value.tag = BACNET_APPLICATION_TAG_REAL;
|
||||
value.type.Real = amount;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Load_Control_WriteProperty_Enable(
|
||||
Test *pTest, int instance, bool enable)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
/* Set Enable=TRUE */
|
||||
wp_data.object_property = PROP_ENABLE;
|
||||
value.context_specific = false;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_BOOLEAN;
|
||||
value.type.Boolean = enable;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
static void Load_Control_WriteProperty_Shed_Duration(
|
||||
Test *pTest, int instance, unsigned duration)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_SHED_DURATION;
|
||||
value.context_specific = false;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT;
|
||||
value.type.Unsigned_Int = duration;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
static void Load_Control_WriteProperty_Duty_Window(
|
||||
Test *pTest, int instance, unsigned duration)
|
||||
{
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_DUTY_WINDOW;
|
||||
value.context_specific = false;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT;
|
||||
value.type.Unsigned_Int = duration;
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
static void Load_Control_WriteProperty_Start_Time_Wildcards(
|
||||
Test *pTest, int instance)
|
||||
{
|
||||
int len = 0;
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_START_TIME;
|
||||
value.context_specific = false;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_DATE;
|
||||
datetime_date_wildcard_set(&value.type.Date);
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
len = wp_data.application_data_len;
|
||||
value.tag = BACNET_APPLICATION_TAG_TIME;
|
||||
datetime_time_wildcard_set(&value.type.Time);
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[len], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
wp_data.application_data_len += len;
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
static void Load_Control_WriteProperty_Start_Time(Test *pTest,
|
||||
int instance,
|
||||
uint16_t year,
|
||||
uint8_t month,
|
||||
uint8_t day,
|
||||
uint8_t hour,
|
||||
uint8_t minute,
|
||||
uint8_t seconds,
|
||||
uint8_t hundredths)
|
||||
{
|
||||
int len = 0;
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
wp_data.array_index = BACNET_ARRAY_ALL;
|
||||
wp_data.priority = BACNET_NO_PRIORITY;
|
||||
wp_data.object_property = PROP_START_TIME;
|
||||
value.context_specific = false;
|
||||
value.context_tag = 0;
|
||||
value.tag = BACNET_APPLICATION_TAG_DATE;
|
||||
datetime_set_date(&value.type.Date, year, month, day);
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
len = wp_data.application_data_len;
|
||||
value.tag = BACNET_APPLICATION_TAG_TIME;
|
||||
datetime_set_time(&value.type.Time, hour, minute, seconds, hundredths);
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[len], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
wp_data.application_data_len += len;
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
void testLoadControlStateMachine(Test *pTest)
|
||||
{
|
||||
unsigned i = 0, j = 0;
|
||||
uint8_t level = 0;
|
||||
|
||||
Load_Control_Init();
|
||||
/* validate the triggers for each state change */
|
||||
for (j = 0; j < 20; j++) {
|
||||
Load_Control_State_Machine(0);
|
||||
for (i = 0; i < MAX_LOAD_CONTROLS; i++) {
|
||||
ct_test(pTest, Load_Control_State[i] == SHED_INACTIVE);
|
||||
}
|
||||
}
|
||||
/* SHED_REQUEST_PENDING */
|
||||
/* CancelShed - Start time has wildcards */
|
||||
Load_Control_WriteProperty_Enable(pTest, 0, true);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 60);
|
||||
Load_Control_WriteProperty_Start_Time_Wildcards(pTest, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_INACTIVE);
|
||||
|
||||
/* CancelShed - Requested_Shed_Level equal to default value */
|
||||
Load_Control_Init();
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 0);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 0);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 5);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 15, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_INACTIVE);
|
||||
|
||||
/* CancelShed - Non-default values, but Start time is passed */
|
||||
Load_Control_Init();
|
||||
Load_Control_WriteProperty_Enable(pTest, 0, true);
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 1);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 5);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 0);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 28, 15, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_INACTIVE);
|
||||
|
||||
/* ReconfigurePending - new write received while pending */
|
||||
Load_Control_Init();
|
||||
Load_Control_WriteProperty_Enable(pTest, 0, true);
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 1);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 5);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 0);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 5, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 2);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 6);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_WriteProperty_Duty_Window(pTest, 0, 60);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 1);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
|
||||
/* CannotMeetShed -> FinishedUnsuccessfulShed */
|
||||
Load_Control_Init();
|
||||
Load_Control_WriteProperty_Enable(pTest, 0, true);
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 1);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 120);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 0);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 5, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
/* set to lowest value so we cannot meet the shed level */
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 16, 0, 0, 0);
|
||||
Analog_Output_Present_Value_Set(0, 0, 16);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_NON_COMPLIANT);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_NON_COMPLIANT);
|
||||
/* FinishedUnsuccessfulShed */
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 23, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_INACTIVE);
|
||||
|
||||
/* CannotMeetShed -> UnsuccessfulShedReconfigured */
|
||||
Load_Control_Init();
|
||||
Load_Control_WriteProperty_Enable(pTest, 0, true);
|
||||
Load_Control_WriteProperty_Request_Shed_Level(pTest, 0, 1);
|
||||
Load_Control_WriteProperty_Shed_Duration(pTest, 0, 120);
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 15, 0, 0, 0);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 5, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
/* set to lowest value so we cannot meet the shed level */
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 16, 0, 0, 0);
|
||||
Analog_Output_Present_Value_Set(0, 0, 16);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_NON_COMPLIANT);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_NON_COMPLIANT);
|
||||
/* FinishedUnsuccessfulShed */
|
||||
Load_Control_WriteProperty_Start_Time(pTest, 0, 2007, 2, 27, 16, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_REQUEST_PENDING);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 16, 0, 1, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_NON_COMPLIANT);
|
||||
/* CanNowComplyWithShed */
|
||||
Analog_Output_Present_Value_Set(0, 100, 16);
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 16, 0, 2, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_COMPLIANT);
|
||||
level = Analog_Output_Present_Value(0);
|
||||
ct_test(pTest, level == 90);
|
||||
/* FinishedSuccessfulShed */
|
||||
datetime_set_values(&Current_Time, 2007, 2, 27, 23, 0, 0, 0);
|
||||
Load_Control_State_Machine(0);
|
||||
ct_test(pTest, Load_Control_State[0] == SHED_INACTIVE);
|
||||
level = Analog_Output_Present_Value(0);
|
||||
ct_test(pTest, level == 100);
|
||||
}
|
||||
|
||||
void testLoadControl(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Analog_Output_Init();
|
||||
Load_Control_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_LOAD_CONTROL;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Load_Control_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_LOAD_CONTROL
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Load Control", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testLoadControl);
|
||||
assert(rc);
|
||||
rc = ct_addTestFunction(pTest, testLoadControlStateMachine);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_LOAD_CONTROL */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -79,13 +79,6 @@ extern "C" {
|
||||
bool Load_Control_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testLoadControl(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -1331,57 +1331,3 @@ void Lighting_Output_Init(void)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testLightingOutput(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Lighting_Output_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_LIGHTING_OUTPUT;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Lighting_Output_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_LIGHTING_OUTPUT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Lighting Output", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testLightingOutput);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_LIGHTING_INPUT */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -216,13 +216,6 @@ extern "C" {
|
||||
bool Lighting_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testLightingOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -371,57 +371,3 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testLifeSafetyPoint(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Life_Safety_Point_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_LIFE_SAFETY_POINT;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Life_Safety_Point_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_LIFE_SAFETY_POINT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Life Safety Point", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testLifeSafetyPoint);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_LIFE_SAFETY_POINT */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -70,13 +70,6 @@ extern "C" {
|
||||
bool Life_Safety_Point_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testLifeSafetyPoint(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -727,64 +727,3 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name,
|
||||
int *object_type,
|
||||
uint32_t *object_instance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void testMultistateInput(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Multistate_Input_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_MULTI_STATE_INPUT;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Multistate_Input_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_MULTISTATE_INPUT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Multi-state Input", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testMultistateInput);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -149,14 +149,6 @@ extern "C" {
|
||||
void Multistate_Input_Init(
|
||||
void);
|
||||
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testMultistateInput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -464,57 +464,3 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testMultistateOutput(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Multistate_Output_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_MULTI_STATE_OUTPUT;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Multistate_Output_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_MULTISTATE_OUTPUT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Multi-state Output", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testMultistateOutput);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_BINARY_INPUT */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -126,14 +126,6 @@ extern "C" {
|
||||
uint32_t object_instance,
|
||||
uint32_t state_index);
|
||||
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testMultistateOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -576,57 +576,3 @@ bool Multistate_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testMultistateInput(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
|
||||
Multistate_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_MULTI_STATE_VALUE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Multistate_Value_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_MULTISTATE_VALUE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Multi-state Input", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testMultistateInput);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -140,14 +140,6 @@ extern "C" {
|
||||
void Multistate_Value_Init(
|
||||
void);
|
||||
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testMultistateValue(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -2427,95 +2427,3 @@ void Network_Port_Init(void)
|
||||
{
|
||||
/* do something interesting */
|
||||
}
|
||||
|
||||
#ifdef BACNET_UNIT_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void test_network_port(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
int test_len = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
/* for decode value data */
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
const int *pRequired = NULL;
|
||||
const int *pOptional = NULL;
|
||||
const int *pProprietary = NULL;
|
||||
unsigned port = 0;
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = 0;
|
||||
bool status = false;
|
||||
uint8_t port_type[] = { PORT_TYPE_ETHERNET, PORT_TYPE_ARCNET,
|
||||
PORT_TYPE_MSTP, PORT_TYPE_PTP, PORT_TYPE_LONTALK, PORT_TYPE_BIP,
|
||||
PORT_TYPE_ZIGBEE, PORT_TYPE_VIRTUAL, PORT_TYPE_NON_BACNET,
|
||||
PORT_TYPE_BIP6, PORT_TYPE_MAX };
|
||||
|
||||
while (port_type[port] != PORT_TYPE_MAX) {
|
||||
object_instance = 1234;
|
||||
status = Network_Port_Object_Instance_Number_Set(0, object_instance);
|
||||
ct_test(pTest, status);
|
||||
status = Network_Port_Type_Set(object_instance, port_type[port]);
|
||||
ct_test(pTest, status);
|
||||
Network_Port_Init();
|
||||
count = Network_Port_Count();
|
||||
ct_test(pTest, count > 0);
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_NETWORK_PORT;
|
||||
rpdata.object_instance = object_instance;
|
||||
Network_Port_Property_Lists(&pRequired, &pOptional, &pProprietary);
|
||||
while ((*pRequired) != -1) {
|
||||
rpdata.object_property = *pRequired;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Network_Port_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
test_len = bacapp_decode_application_data(rpdata.application_data,
|
||||
(uint8_t)rpdata.application_data_len, &value);
|
||||
ct_test(pTest, test_len >= 0);
|
||||
if (test_len < 0) {
|
||||
printf("<decode failed!>\n");
|
||||
}
|
||||
pRequired++;
|
||||
}
|
||||
while ((*pOptional) != -1) {
|
||||
rpdata.object_property = *pOptional;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Network_Port_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
test_len = bacapp_decode_application_data(rpdata.application_data,
|
||||
(uint8_t)rpdata.application_data_len, &value);
|
||||
ct_test(pTest, test_len >= 0);
|
||||
if (test_len < 0) {
|
||||
printf("<decode failed!>\n");
|
||||
}
|
||||
pOptional++;
|
||||
}
|
||||
port++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_NETWORK_PORT
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Network Port", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, test_network_port);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -355,57 +355,3 @@ bool OctetString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
void OctetString_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testOctetString_Value(Test *pTest)
|
||||
{
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
|
||||
OctetString_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_OCTETSTRING_VALUE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = OctetString_Value_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_OCTETSTRING_VALUE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet OctetString Value", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testOctetString_Value);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_OCTETSTRING_VALUE */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -104,12 +104,6 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
void OctetString_Value_Init(void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testOctetString_Value(Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -360,57 +360,3 @@ bool PositiveInteger_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
void PositiveInteger_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testPositiveInteger_Value(Test *pTest)
|
||||
{
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
|
||||
PositiveInteger_Value_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_POSITIVE_INTEGER_VALUE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = PositiveInteger_Value_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_POSITIVEINTEGER_VALUE
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet PositiveInteger Value", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testPositiveInteger_Value);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_POSITIVEINTEGER_VALUE */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
@@ -103,12 +103,6 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
void PositiveInteger_Value_Init(void);
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include "ctest.h"
|
||||
BACNET_STACK_EXPORT
|
||||
void testPositiveInteger_Value(Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -424,59 +424,3 @@ void Schedule_Recalculate_PV(
|
||||
desc->Present_Value = &desc->Schedule_Default;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BAC_TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testSchedule(Test *pTest)
|
||||
{
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
uint16_t decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
|
||||
Schedule_Init();
|
||||
rpdata.application_data = &apdu[0];
|
||||
rpdata.application_data_len = sizeof(apdu);
|
||||
rpdata.object_type = OBJECT_SCHEDULE;
|
||||
rpdata.object_instance = 1;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Schedule_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
||||
ct_test(pTest, decoded_type == rpdata.object_type);
|
||||
ct_test(pTest, decoded_instance == rpdata.object_instance);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TEST_SCHEDULE
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
|
||||
pTest = ct_create("BACnet Schedule", NULL);
|
||||
/* individual tests */
|
||||
rc = ct_addTestFunction(pTest, testSchedule);
|
||||
assert(rc);
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* TEST_SCHEDULE */
|
||||
#endif /* BAC_TEST */
|
||||
|
||||
Reference in New Issue
Block a user