diff options
Diffstat (limited to 'test/ut.c')
-rw-r--r-- | test/ut.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ut.c b/test/ut.c index c64f0b554d5..95bdd66de6a 100644 --- a/test/ut.c +++ b/test/ut.c @@ -59,6 +59,28 @@ int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...) return strcmp(uts->expect_str, uts->actual_str); } +int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return strncmp(uts->expect_str, uts->actual_str, + strlen(uts->expect_str)); +} + +int ut_check_skipline(struct unit_test_state *uts) +{ + if (!console_record_avail()) + return -ENFILE; + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return 0; +} + int ut_check_console_end(struct unit_test_state *uts) { if (!console_record_avail()) |