Fix tests: (#314)
- misprint in ports/zephyr/bip-init.c - error processing PROP_TRACKING_VALUE for the Color Temperature object in src/bacnet/bacapp.c - misprint MSV test - add hostnport.c for each zephyr tests - fix colors and ms-input tests - remove mocking Device_Inc_Database_Revision() for zephyr tests - debug the color temperature test
This commit is contained in:
@@ -91,6 +91,7 @@ list(APPEND testdirs
|
||||
bacnet/basic/object/bo
|
||||
bacnet/basic/object/bv
|
||||
bacnet/basic/object/color_object
|
||||
bacnet/basic/object/color_temperature
|
||||
bacnet/basic/object/command
|
||||
bacnet/basic/object/credential_data_input
|
||||
bacnet/basic/object/device
|
||||
|
||||
@@ -54,6 +54,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
${ZTST_DIR}/ztest.c
|
||||
)
|
||||
|
||||
@@ -10,22 +10,6 @@
|
||||
#include <bacnet/bactext.h>
|
||||
#include <bacnet/basic/object/color_object.h>
|
||||
|
||||
|
||||
bool Device_Valid_Object_Name(
|
||||
BACNET_CHARACTER_STRING * object_name,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t * object_instance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Device_Inc_Database_Revision(
|
||||
void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
* @{
|
||||
|
||||
@@ -54,6 +54,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
${ZTST_DIR}/ztest.c
|
||||
)
|
||||
|
||||
@@ -11,21 +11,6 @@
|
||||
#include <bacnet/basic/object/color_temperature.h>
|
||||
|
||||
|
||||
bool Device_Valid_Object_Name(
|
||||
BACNET_CHARACTER_STRING * object_name,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t * object_instance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Device_Inc_Database_Revision(
|
||||
void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
* @{
|
||||
@@ -53,11 +38,11 @@ static void testColorTemperature(void)
|
||||
rpdata.object_instance = instance;
|
||||
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
||||
|
||||
Color_Property_Lists(&required_property, NULL, NULL);
|
||||
Color_Temperature_Property_Lists(&required_property, NULL, NULL);
|
||||
while ((*required_property) >= 0) {
|
||||
rpdata.object_property = *required_property;
|
||||
rpdata.array_index = BACNET_ARRAY_ALL;
|
||||
len = Color_Read_Property(&rpdata);
|
||||
len = Color_Temperature_Read_Property(&rpdata);
|
||||
zassert_true(len >= 0, NULL);
|
||||
if (len >= 0) {
|
||||
test_len = bacapp_decode_known_property(rpdata.application_data,
|
||||
|
||||
@@ -24,10 +24,6 @@ static void testLightingOutput(void)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0, test_len = 0;
|
||||
uint32_t len_value = 0;
|
||||
uint8_t tag_number = 0;
|
||||
BACNET_OBJECT_TYPE decoded_type = 0;
|
||||
uint32_t decoded_instance = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata;
|
||||
BACNET_APPLICATION_DATA_VALUE value = {0};
|
||||
const int *required_property = NULL;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief mock Device object functions
|
||||
* @author Mikhail Antropov
|
||||
* @date July 2022
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include <ztest.h>
|
||||
#include <bacnet/bactext.h>
|
||||
#include <bacnet/basic/object/device.h>
|
||||
|
||||
|
||||
bool Device_Valid_Object_Name(
|
||||
BACNET_CHARACTER_STRING * object_name,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t * object_instance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Device_Inc_Database_Revision(
|
||||
void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
${ZTST_DIR}/ztest.c
|
||||
)
|
||||
|
||||
@@ -11,19 +11,6 @@
|
||||
#include <ztest.h>
|
||||
#include <bacnet/basic/object/ms-input.h>
|
||||
|
||||
/**
|
||||
* stub
|
||||
*/
|
||||
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *object_instance)
|
||||
{
|
||||
(void)object_name;
|
||||
(void)object_type;
|
||||
(void)object_instance;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
* @{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/**
|
||||
* @brief Test
|
||||
*/
|
||||
static void testMultistateInput(void)
|
||||
static void testMultistateValue(void)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
@@ -54,7 +54,7 @@ static void testMultistateInput(void)
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(msv_tests,
|
||||
ztest_unit_test(testMultistateInput)
|
||||
ztest_unit_test(testMultistateValue)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(msv_tests);
|
||||
|
||||
Reference in New Issue
Block a user