Corrected unit tests for iam, event, ai, and bacdevobjpropref. Removed device from unit test since it needs reworked for unit testing due to object dependencies. Noted that lc object fails test and needs fixed.

This commit is contained in:
skarg
2011-08-17 03:47:43 +00:00
parent 3e1cb1847f
commit 8d9b987064
6 changed files with 45 additions and 22 deletions
+29 -2
View File
@@ -105,7 +105,10 @@ void Analog_Input_Property_Lists(
void Analog_Input_Init(
void)
{
unsigned i, j;
unsigned i;
#if defined(INTRINSIC_REPORTING)
unsigned j;
#endif
for (i = 0; i < MAX_ANALOG_INPUTS; i++) {
AI_Descr[i].Present_Value = 0.0f;
@@ -226,13 +229,15 @@ bool Analog_Input_Object_Name(
int Analog_Input_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata)
{
int len = 0;
int apdu_len = 0; /* return value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
ANALOG_INPUT_DESCR *CurrentAI;
unsigned object_index = 0;
#if defined(INTRINSIC_REPORTING)
unsigned i = 0;
int len = 0;
#endif
uint8_t *apdu = NULL;
if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
@@ -1121,6 +1126,28 @@ int Analog_Input_Alarm_Ack(
#include <string.h>
#include "ctest.h"
bool WPValidateArgType(
BACNET_APPLICATION_DATA_VALUE * pValue,
uint8_t ucExpectedTag,
BACNET_ERROR_CLASS * pErrorClass,
BACNET_ERROR_CODE * pErrorCode)
{
bool bResult;
/*
* start out assuming success and only set up error
* response if validation fails.
*/
bResult = true;
if (pValue->tag != ucExpectedTag) {
bResult = false;
*pErrorClass = ERROR_CLASS_PROPERTY;
*pErrorCode = ERROR_CODE_INVALID_DATA_TYPE;
}
return (bResult);
}
void testAnalogInput(
Test * pTest)
{
+11 -6
View File
@@ -2,8 +2,9 @@
CC = gcc
SRC_DIR = ../../src
TEST_DIR = ../../test
INCLUDES = -I../../include -I$(TEST_DIR) -I.
DEFINES = -DBIG_ENDIAN=0 -DTEST -DTEST_ANALOG_INPUT
HANDLER_DIR = ../handler
INCLUDES = -I../../include -I$(TEST_DIR) -I. -I$(HANDLER_DIR)
DEFINES = -DBIG_ENDIAN=0 -DBACDL_ALL -DTEST -DTEST_ANALOG_INPUT
CFLAGS = -Wall $(INCLUDES) $(DEFINES) -g
@@ -12,24 +13,28 @@ SRCS = ai.c \
$(SRC_DIR)/bacint.c \
$(SRC_DIR)/bacstr.c \
$(SRC_DIR)/bacreal.c \
$(SRC_DIR)/bacapp.c \
$(SRC_DIR)/bactext.c \
$(SRC_DIR)/indtext.c \
$(SRC_DIR)/datetime.c \
$(TEST_DIR)/ctest.c
TARGET = analog_input
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)