1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Remove broken ltoa/ultoa, call itoa/utoa (#5625)

* Remove broken ltoa/ultoa, call itoa/utoa

Use the newlib integer-to-ASCII non-POSIX calls instead of rolling
our own.  Should be safe as sizeof(long) == sizeof(int).
The custom functions behaved differently from itoa when passed in
negative values in non-base-10.

Add host tests for negative non-base-10 int/longs
This commit is contained in:
Earle F. Philhower, III
2019-01-17 02:08:19 +00:00
committed by GitHub
parent 7ee503d353
commit 6883beedec
3 changed files with 25 additions and 52 deletions

View File

@ -115,6 +115,15 @@ TEST_CASE("String concantenation", "[core][String]")
str = "clean";
REQUIRE(str.concat(str) == true);
REQUIRE(str == "cleanclean");
// non-decimal negative #s should be as if they were unsigned
str = String((int)-100, 16);
REQUIRE(str == "ffffff9c");
str = String((long)-101, 16);
REQUIRE(str == "ffffff9b");
str = String((int)-100, 10);
REQUIRE(str == "-100");
str = String((long)-100, 10);
REQUIRE(str == "-100");
}
TEST_CASE("String comparison", "[core][String]")