Updated unit tests for objects and services, and corrected some portability problems. Thanks, Sergei! Didn't fix mstp or load control unit test results.
This commit is contained in:
@@ -484,6 +484,20 @@ bool Analog_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testAnalogOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -21,19 +21,19 @@ SRCS = ao.c \
|
||||
TARGET = analog_output
|
||||
|
||||
all: ${TARGET}
|
||||
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
${TARGET}: ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf core ${TARGET} $(OBJS)
|
||||
|
||||
|
||||
@@ -441,6 +441,20 @@ bool Analog_Value_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testAnalog_Value(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -480,6 +480,20 @@ bool Binary_Input_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinaryInput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -448,6 +448,20 @@ bool Binary_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinaryOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -430,6 +430,20 @@ bool Binary_Value_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinary_Value(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -1435,6 +1435,46 @@ void Routing_Device_Init(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WPValidateString(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
int iMaxLen,
|
||||
bool bEmptyAllowed,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
iMaxLen=iMaxLen;
|
||||
bEmptyAllowed=bEmptyAllowed;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
CC = gcc
|
||||
SRC_DIR = ../../src
|
||||
TEST_DIR = ../../test
|
||||
INCLUDES = -I../../include -I$(TEST_DIR) -I.
|
||||
PORTS_DIR = ../../ports/linux
|
||||
INCLUDES = -I../../include -I$(TEST_DIR) -I$(PORTS_DIR) -I.
|
||||
DEFINES = -DBIG_ENDIAN=0
|
||||
DEFINES += -DTEST -DBACDL_TEST
|
||||
DEFINES += -DBACAPP_ALL
|
||||
@@ -21,6 +22,8 @@ SRCS = device.c \
|
||||
$(SRC_DIR)/bactext.c \
|
||||
$(SRC_DIR)/indtext.c \
|
||||
$(SRC_DIR)/apdu.c \
|
||||
$(SRC_DIR)/address.c \
|
||||
$(SRC_DIR)/bacaddr.c \
|
||||
$(SRC_DIR)/dcc.c \
|
||||
$(SRC_DIR)/version.c \
|
||||
$(TEST_DIR)/ctest.c
|
||||
@@ -28,19 +31,19 @@ SRCS = device.c \
|
||||
TARGET = device
|
||||
|
||||
all: ${TARGET}
|
||||
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
${TARGET}: ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf core ${TARGET} $(OBJS)
|
||||
|
||||
|
||||
@@ -1089,8 +1089,6 @@ static void Load_Control_WriteProperty_Request_Shed_Percent(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1104,7 +1102,7 @@ static void Load_Control_WriteProperty_Request_Shed_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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
@@ -1117,8 +1115,6 @@ static void Load_Control_WriteProperty_Request_Shed_Level(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1132,7 +1128,7 @@ static void Load_Control_WriteProperty_Request_Shed_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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1145,8 +1141,6 @@ static void Load_Control_WriteProperty_Request_Shed_Amount(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1160,7 +1154,7 @@ static void Load_Control_WriteProperty_Request_Shed_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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
@@ -1173,8 +1167,6 @@ static void Load_Control_WriteProperty_Enable(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1189,7 +1181,7 @@ static void Load_Control_WriteProperty_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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1201,8 +1193,6 @@ static void Load_Control_WriteProperty_Shed_Duration(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1216,7 +1206,7 @@ static void Load_Control_WriteProperty_Shed_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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1228,8 +1218,6 @@ static void Load_Control_WriteProperty_Duty_Window(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1243,7 +1231,7 @@ static void Load_Control_WriteProperty_Duty_Window(
|
||||
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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1255,8 +1243,6 @@ static void Load_Control_WriteProperty_Start_Time_Wildcards(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1277,7 +1263,7 @@ static void Load_Control_WriteProperty_Start_Time_Wildcards(
|
||||
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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1296,8 +1282,6 @@ static void Load_Control_WriteProperty_Start_Time(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1318,7 +1302,7 @@ static void Load_Control_WriteProperty_Start_Time(
|
||||
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, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
/* Lighting Output Objects - customize for your use */
|
||||
|
||||
/* WARNING! This object is still BACnet DRAFT status!
|
||||
If you need to implement in a real product, you will
|
||||
/* WARNING! This object is still BACnet DRAFT status!
|
||||
If you need to implement in a real product, you will
|
||||
need to modify the new OBJECT type and properties to
|
||||
be in the proprietrary range to be BACnet compliant */
|
||||
|
||||
@@ -606,6 +606,20 @@ bool Lighting_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testLightingOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -361,6 +361,20 @@ bool Life_Safety_Point_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testLifeSafetyPoint(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -525,6 +525,20 @@ bool Multistate_Input_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testMultistateInput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -451,6 +451,20 @@ bool Multistate_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testMultistateOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user