32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/*
|
||
* 主机侧单测桩:dbg_log.h
|
||
* 模块功能:为 cfg_file.c 提供主机可编译的日志宏(映射到 printf / 计数)。
|
||
*
|
||
* ⚠ 仅供 test/host/cfg_file/ 使用,不参与 MCU 构建。
|
||
*
|
||
* MCU 版依赖 sys_clock(RTC 时间戳)与 USART;主机侧替换为计数/直通,
|
||
* 使"非法键值是否留痕"(DBG_ERROR)与"注册/加载成功日志"(DBG_INFO)
|
||
* 成为可观测行为——单测据此断言既有留痕、又不被噪声淹没。
|
||
*
|
||
* 创建日期:2026-10-02
|
||
*/
|
||
|
||
#ifndef DBG_LOG_H
|
||
#define DBG_LOG_H
|
||
|
||
#include <stdio.h>
|
||
|
||
/* 测试观测计数(在 cfg_file_test.c 实现):
|
||
* g_cfgtest_err_count —— DBG_ERROR 次数(如非法键值留痕)
|
||
* g_cfgtest_info_count —— DBG_INFO 次数(如 load 成功)
|
||
* g_cfgtest_debug_count—— DBG_DEBUG 次数 */
|
||
extern int g_cfgtest_err_count;
|
||
extern int g_cfgtest_info_count;
|
||
extern int g_cfgtest_debug_count;
|
||
|
||
#define DBG_INFO(fmt, ...) do { g_cfgtest_info_count++; } while (0)
|
||
#define DBG_DEBUG(fmt, ...) do { g_cfgtest_debug_count++; } while (0)
|
||
#define DBG_ERROR(fmt, ...) do { g_cfgtest_err_count++; } while (0)
|
||
|
||
#endif /* DBG_LOG_H */
|