From 0f3c70649a3d8035b0c0f9658705505948b2c60a Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 5 Aug 2022 15:30:12 +0200 Subject: shared/printf: implement %d --- src/user/app/tests/shared/printf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/user/app/tests/shared/printf.c') diff --git a/src/user/app/tests/shared/printf.c b/src/user/app/tests/shared/printf.c index 04175db..4e5ffb8 100644 --- a/src/user/app/tests/shared/printf.c +++ b/src/user/app/tests/shared/printf.c @@ -26,8 +26,13 @@ static void test_printf(void) { snprintf(buf, sizeof buf, "%05u %05u", 1234, 56789); test(!strcmp(buf, "01234 56789")); - snprintf(buf, sizeof buf, "%u %x", 0, 0); - test(!strcmp(buf, "0 0")); + snprintf(buf, sizeof buf, "%5d %5d", 123, 4567); + test(!strcmp(buf, " 123 4567")); + snprintf(buf, sizeof buf, "%5d %5d", -123, -4567); + test(!strcmp(buf, " -123 -4567")); + + snprintf(buf, sizeof buf, "%u %d %x", 0, 0, 0); + test(!strcmp(buf, "0 0 0")); } void r_s_printf(void) { -- cgit v1.2.3