From ae8c5f5e1cdbd74a4e04c80acf1d9093bf4bc22c Mon Sep 17 00:00:00 2001 From: Jiang Guang Ming Date: Fri, 24 May 2024 17:44:59 +0800 Subject: [PATCH] feat(newlib): add test case for printf float --- components/newlib/test_apps/newlib/main/test_newlib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/newlib/test_apps/newlib/main/test_newlib.c b/components/newlib/test_apps/newlib/main/test_newlib.c index 729499cb22..48cd9d0992 100644 --- a/components/newlib/test_apps/newlib/main/test_newlib.c +++ b/components/newlib/test_apps/newlib/main/test_newlib.c @@ -230,3 +230,10 @@ TEST_CASE("newlib: rom and toolchain localtime func gives the same result", "[ne printf("%s\n", test_result); TEST_ASSERT_EQUAL_STRING("2020-03-12 15:00:00 EDT (tm_isdst = 1)", test_result); } + +TEST_CASE("newlib: printf float as expected", "[newlib]") +{ + const float val = 1.23; + int len = printf("test printf float val is %1.2f\n", val); + TEST_ASSERT_EQUAL_INT(30, len); +}