Remove BACFILE dependency in RAM file systems and add mock file object functions for testing (#1227)

This commit is contained in:
Steve Karg
2026-02-12 17:15:31 -06:00
committed by GitHub
parent 9f508c8f2f
commit 9330c47a34
6 changed files with 75 additions and 4 deletions
@@ -0,0 +1,69 @@
/**
* @file
* @brief mock file object functions
* @author Steve Karg <skarg@users.sourceforge.net>
* @date February 2026
*
* @copyright SPDX-License-Identifier: MIT
*/
#include <zephyr/ztest.h>
#include <bacnet/bactext.h>
#include <bacnet/basic/object/bacfile.h>
/**
* @brief Sets the callback function for writing stream data
* @param callback - function pointer to the callback
*/
void bacfile_write_stream_data_callback_set(
size_t (*callback)(const char *, int32_t, const uint8_t *, size_t))
{
(void)callback;
}
/**
* @brief Sets the callback function for writing record data
* @param callback - function pointer to the callback
*/
void bacfile_write_record_data_callback_set(
bool (*callback)(const char *, int32_t, size_t, const uint8_t *, size_t))
{
(void)callback;
}
/**
* @brief Sets the callback function for reading record data
* @param callback - function pointer to the callback
*/
void bacfile_read_record_data_callback_set(
bool (*callback)(const char *, int32_t, size_t, uint8_t *, size_t))
{
(void)callback;
}
/**
* @brief Sets the callback function for reading stream data
* @param callback - function pointer to the callback
*/
void bacfile_read_stream_data_callback_set(
size_t (*callback)(const char *, int32_t, uint8_t *, size_t))
{
(void)callback;
}
/**
* @brief Sets the callback function for getting file size
* @param callback - function pointer to the callback
*/
void bacfile_file_size_callback_set(size_t (*callback)(const char *))
{
(void)callback;
}
/**
* @brief Sets the callback function for setting file size
* @param callback - function pointer to the callback
*/
void bacfile_file_size_set_callback_set(bool (*callback)(const char *, size_t))
{
(void)callback;
}
@@ -28,6 +28,7 @@ add_compile_definitions(
include_directories(
${SRC_DIR}
${TST_DIR}/ztest/include
${TST_DIR}/bacnet/basic/object/test
)
add_executable(${PROJECT_NAME}
@@ -40,6 +41,7 @@ add_executable(${PROJECT_NAME}
# Support files and stubs (pathname alphabetical)
# Test and test library files
./src/main.c
${TST_DIR}/bacnet/basic/object/test/bacfile_mock.c
${ZTST_DIR}/ztest_mock.c
${ZTST_DIR}/ztest.c
)
@@ -28,6 +28,7 @@ add_compile_definitions(
include_directories(
${SRC_DIR}
${TST_DIR}/ztest/include
${TST_DIR}/bacnet/basic/object/test
)
add_executable(${PROJECT_NAME}
@@ -40,6 +41,7 @@ add_executable(${PROJECT_NAME}
# Support files and stubs (pathname alphabetical)
# Test and test library files
./src/main.c
${TST_DIR}/bacnet/basic/object/test/bacfile_mock.c
${ZTST_DIR}/ztest_mock.c
${ZTST_DIR}/ztest.c
)