Files
ctdd/tests/test_report.c
T
portersky 701c644408 feat: add log levels to logger
Replace log_message with log_debug/info/warn/err and a level filter
controlled by logger_set_level. Extract the printf sink into
log_write so CMock can intercept it in test_logger. Add 9 tests
covering emit and suppression behaviour per level.
2026-05-09 20:43:32 +02:00

36 lines
844 B
C

#include "unity.h"
#include "ctdd/report.h"
#include "Mocklogger.h"
void setUp(void) { Mocklogger_Init(); }
void tearDown(void) { Mocklogger_Verify(); Mocklogger_Destroy(); }
void test_report_formats_label_and_value(void) {
log_info_Expect("count: 42");
report_value("count", 42);
}
void test_report_negative_value(void) {
log_info_Expect("score: -5");
report_value("score", -5);
}
void test_report_zero(void) {
log_info_Expect("total: 0");
report_value("total", 0);
}
void test_report_calls_log_exactly_once(void) {
log_info_Expect("x: 1");
report_value("x", 1);
}
int main(void) {
UNITY_BEGIN();
RUN_TEST(test_report_formats_label_and_value);
RUN_TEST(test_report_negative_value);
RUN_TEST(test_report_zero);
RUN_TEST(test_report_calls_log_exactly_once);
return UNITY_END();
}