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:
Mikhail Antropov
2022-07-30 11:31:38 +03:00
committed by GitHub
parent a945588340
commit 4b742effe1
46 changed files with 233 additions and 54 deletions
@@ -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,
-4
View File
@@ -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
* @{
+2 -2
View File
@@ -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);