diff options
author | crupest <crupest@outlook.com> | 2022-03-08 17:24:07 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-08 17:24:07 +0800 |
commit | 78f5221e8fbab510bb8b5ac268b7d42bed762961 (patch) | |
tree | 2066be748d39411e4dd6a74a538df4ca4a213543 /test | |
parent | 62a0c3f1785e789357c892d94b3ea0bc3ea6833e (diff) | |
download | cru-78f5221e8fbab510bb8b5ac268b7d42bed762961.tar.gz cru-78f5221e8fbab510bb8b5ac268b7d42bed762961.tar.bz2 cru-78f5221e8fbab510bb8b5ac268b7d42bed762961.zip |
...
Diffstat (limited to 'test')
-rw-r--r-- | test/common/StringTest.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/common/StringTest.cpp b/test/common/StringTest.cpp index c6e190c4..e053400e 100644 --- a/test/common/StringTest.cpp +++ b/test/common/StringTest.cpp @@ -86,10 +86,18 @@ TEST(String, FromUtf8) { } TEST(StringView, ParseToDouble) { + using cru::StringToFloatFlags; using cru::StringView; ASSERT_EQ(StringView(u"3.14159").ParseToDouble(), 3.14159); - ASSERT_EQ(StringView(u" 3.14159").ParseToDouble(), 3.14159); - ASSERT_EQ(StringView(u" 3.14159 ").ParseToDouble(), 3.14159); + ASSERT_EQ( + StringView(u" 3.14159") + .ParseToDouble(nullptr, StringToFloatFlags::kAllowLeadingSpaces), + 3.14159); + ASSERT_EQ( + StringView(u" 3.14159 ") + .ParseToDouble(nullptr, StringToFloatFlags::kAllowLeadingSpaces | + StringToFloatFlags::kAllowTrailingSpaces), + 3.14159); } TEST(String, ParseToDoubleList) { |