diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-10-17 14:06:48 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-10-17 14:06:48 +0800 |
commit | 5c5c496b605886b286d1b99e0f9e28ec02117ad5 (patch) | |
tree | c22b07e81ba179d7cc8790656abddbcc56b5d704 /test/base/StringTest.cpp | |
parent | 32aa6f116acc6e3e20a1ec76cef45b29f7005ad7 (diff) | |
download | cru-5c5c496b605886b286d1b99e0f9e28ec02117ad5.tar.gz cru-5c5c496b605886b286d1b99e0f9e28ec02117ad5.tar.bz2 cru-5c5c496b605886b286d1b99e0f9e28ec02117ad5.zip |
Use std::from_chars.
Diffstat (limited to 'test/base/StringTest.cpp')
-rw-r--r-- | test/base/StringTest.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/test/base/StringTest.cpp b/test/base/StringTest.cpp index 9ed351e5..65fe0a99 100644 --- a/test/base/StringTest.cpp +++ b/test/base/StringTest.cpp @@ -84,29 +84,3 @@ TEST_CASE("String FromUtf8", "[string]") { REQUIRE(cru::String::FromUtf8(utf8_text) == utf16_text); } - -TEST_CASE("StringView ParseToDouble", "[string]") { - using cru::StringToNumberFlags; - using cru::StringView; - REQUIRE(StringView(u"3.14159").ParseToDouble() == 3.14159); - REQUIRE( - StringView(u" 3.14159") - .ParseToDouble(nullptr, StringToNumberFlags::kAllowLeadingSpaces) == - 3.14159); - REQUIRE(StringView(u" 3.14159 ") - .ParseToDouble(nullptr, - StringToNumberFlags::kAllowLeadingSpaces | - StringToNumberFlags::kAllowTrailingSpaces) == - 3.14159); -} - -TEST_CASE("String ParseToDoubleList", "[string]") { - using cru::StringView; - - auto list = StringView(u" 1.23 2.34 3.45 ").ParseToDoubleList(); - - REQUIRE(list.size() == 3); - REQUIRE(list[0] == 1.23); - REQUIRE(list[1] == 2.34); - REQUIRE(list[2] == 3.45); -} |