diff options
author | crupest <crupest@outlook.com> | 2021-10-22 21:42:45 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-10-22 21:42:45 +0800 |
commit | 3e84cf013b31c52405a76b8e8778a5991d096290 (patch) | |
tree | 4d3b2d2ef5a9625c55f798d88281073e806ee83f /test | |
parent | ed640ca9e3c7482856a0248ea38adafc86a7d4c8 (diff) | |
download | cru-3e84cf013b31c52405a76b8e8778a5991d096290.tar.gz cru-3e84cf013b31c52405a76b8e8778a5991d096290.tar.bz2 cru-3e84cf013b31c52405a76b8e8778a5991d096290.zip |
...
Diffstat (limited to 'test')
-rw-r--r-- | test/common/StringTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/common/StringTest.cpp b/test/common/StringTest.cpp index a0895af9..53ed359f 100644 --- a/test/common/StringTest.cpp +++ b/test/common/StringTest.cpp @@ -11,6 +11,17 @@ TEST(String, Append) { ASSERT_EQ(s, String(u"haha")); } +TEST(String, IndexConvert) { + using cru::String; + + String s(u"123"); + ASSERT_EQ(s.IndexFromCodePointToCodeUnit(1), 1); + ASSERT_EQ(s.IndexFromCodeUnitToCodePoint(1), 1); + ASSERT_EQ(s.IndexFromCodeUnitToCodePoint(3), 3); + ASSERT_EQ(s.IndexFromCodeUnitToCodePoint(3), 3); + +} + TEST(String, Format) { using cru::Format; using cru::String; |