701c644408
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.
20 lines
512 B
C
20 lines
512 B
C
#include "ctdd/str.h"
|
|
#include "ctdd/report.h"
|
|
#include "ctdd/logger.h"
|
|
|
|
int main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) {
|
|
char const* words[] = { "hello", "world", "ctdd", "tdd" };
|
|
int n = 4, tdd_words = 0;
|
|
for (int i = 0; i < n; i++) {
|
|
if (str_ends_with(words[i], "tdd"))
|
|
tdd_words++;
|
|
}
|
|
report_value("words ending in 'tdd'", tdd_words);
|
|
|
|
char upper[32];
|
|
str_upper(upper, "hello, tdd", sizeof(upper));
|
|
log_info(upper);
|
|
|
|
return 0;
|
|
}
|