mirror of
https://github.com/espressif/openthread.git
synced 2026-10-14 11:47:38 +00:00
[string] add StringParseUint8() helper function (#9026)
This commit adds a helper function to parse a decimal number from a given string as `uint8_t` and skip over the parsed characters. This is used to simplify the methods parsing IPv6/IPv4 address or prefix from a string.
This commit is contained in:
@@ -295,6 +295,7 @@ void TestIp4CidrFromString(void)
|
||||
// valid address, invalid suffix
|
||||
{"1.2.3.4/33", {0}, 0, ot::kErrorParse}, // Prefix length too large
|
||||
{"1.2.3.4/12345678", {0}, 0, ot::kErrorParse}, // Prefix length too large?
|
||||
{"1.2.3.4/12a", {0}, 0, ot::kErrorParse}, // Extra char after prefix length.
|
||||
{"1.2.3.4/-1", {0}, 0, ot::kErrorParse}, // Not even a non-negative integer.
|
||||
{"1.2.3.4/3.14", {0}, 0, ot::kErrorParse}, // Not even a integer.
|
||||
{"1.2.3.4/abcd", {0}, 0, ot::kErrorParse}, // Not even a number.
|
||||
|
||||
Reference in New Issue
Block a user