mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(newlib): add test case for printf float
This commit is contained in:
parent
97c5bc51e6
commit
09b1844a0a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -132,7 +132,7 @@ static bool fn_in_rom(void *fn)
|
||||
/* Older chips have newlib nano in rom as well, but this is not linked in due to us now using 64 bit time_t
|
||||
and the ROM code was compiled for 32 bit.
|
||||
*/
|
||||
#define PRINTF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && (CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32H2))
|
||||
#define PRINTF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
|
||||
#define SSCANF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
|
||||
|
||||
TEST_CASE("check if ROM or Flash is used for functions", "[newlib]")
|
||||
@ -233,3 +233,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user