diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-10-17 14:33:16 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-10-17 14:33:16 +0800 |
commit | 9f419314b646bf57dfc3fcbb509b3be2c974e3fd (patch) | |
tree | 6d40efce7beade635b6480a9b4e7db2f114c2145 /test | |
parent | 5c5c496b605886b286d1b99e0f9e28ec02117ad5 (diff) | |
download | cru-9f419314b646bf57dfc3fcbb509b3be2c974e3fd.tar.gz cru-9f419314b646bf57dfc3fcbb509b3be2c974e3fd.tar.bz2 cru-9f419314b646bf57dfc3fcbb509b3be2c974e3fd.zip |
Remove String on Linux.
Diffstat (limited to 'test')
-rw-r--r-- | test/base/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/base/StringTest.cpp | 86 | ||||
-rw-r--r-- | test/base/StringUtilTest.cpp | 1 |
3 files changed, 0 insertions, 88 deletions
diff --git a/test/base/CMakeLists.txt b/test/base/CMakeLists.txt index 13a0a2cb..b008e1b3 100644 --- a/test/base/CMakeLists.txt +++ b/test/base/CMakeLists.txt @@ -3,7 +3,6 @@ add_executable(CruBaseTest HandlerRegistryTest.cpp PropertyTreeTest.cpp SelfResolvableTest.cpp - StringTest.cpp StringUtilTest.cpp SubProcessTest.cpp ) diff --git a/test/base/StringTest.cpp b/test/base/StringTest.cpp deleted file mode 100644 index 65fe0a99..00000000 --- a/test/base/StringTest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "cru/base/Format.h" -#include "cru/base/String.h" - -#include <catch2/catch_test_macros.hpp> - -TEST_CASE("String Append", "[string]") { - using cru::String; - - String s; - s.append(u"ha"); - s.append(s); - REQUIRE(s == String(u"haha")); -} - -TEST_CASE("String IndexConvert", "[string]") { - using cru::String; - - String s(u"123"); - REQUIRE(s.IndexFromCodePointToCodeUnit(1) == 1); - REQUIRE(s.IndexFromCodeUnitToCodePoint(1) == 1); - REQUIRE(s.IndexFromCodeUnitToCodePoint(3) == 3); - REQUIRE(s.IndexFromCodeUnitToCodePoint(3) == 3); -} - -TEST_CASE("String Format", "[string]") { - using cru::Format; - using cru::String; - - REQUIRE(Format(u"{} + {} = {}", 123, 321, 444) == String(u"123 + 321 = 444")); -} - -TEST_CASE("String Trim", "[string]") { - using cru::String; - REQUIRE(String(u" abc ").Trim() == u"abc"); -} - -TEST_CASE("String SplitToLines", "[string]") { - using cru::String; - - String s(u"abc\ndef\nghi"); - auto lines = s.SplitToLines(); - REQUIRE(lines.size() == 3); - REQUIRE(lines[0] == String(u"abc")); - REQUIRE(lines[1] == String(u"def")); - REQUIRE(lines[2] == String(u"ghi")); -} - -TEST_CASE("String SplitToLinesWithEmptyLine", "[string]") { - using cru::String; - - String s(u"abc\n \ndef\n\nghi\n"); - auto lines = s.SplitToLines(); - REQUIRE(lines.size() == 6); - REQUIRE(lines[0] == String(u"abc")); - REQUIRE(lines[1] == String(u" ")); - REQUIRE(lines[2] == String(u"def")); - REQUIRE(lines[3] == String(u"")); - REQUIRE(lines[4] == String(u"ghi")); - REQUIRE(lines[5] == String(u"")); -} - -TEST_CASE("String SplitToLinesRemoveSpaceLine", "[string]") { - using cru::String; - - String s(u"abc\n \ndef\n\nghi\n"); - auto lines = s.SplitToLines(true); - REQUIRE(lines.size() == 3); - REQUIRE(lines[0] == String(u"abc")); - REQUIRE(lines[1] == String(u"def")); - REQUIRE(lines[2] == String(u"ghi")); -} - -TEST_CASE("StringView ToUtf8", "[string]") { - using cru::StringView; - StringView utf16_text = u"aπ你🤣!"; - std::string_view utf8_text = "aπ你🤣!"; - - REQUIRE(utf16_text.ToUtf8() == utf8_text); -} - -TEST_CASE("String FromUtf8", "[string]") { - std::u16string_view utf16_text = u"aπ你🤣!"; - std::string_view utf8_text = "aπ你🤣!"; - - REQUIRE(cru::String::FromUtf8(utf8_text) == utf16_text); -} diff --git a/test/base/StringUtilTest.cpp b/test/base/StringUtilTest.cpp index 5951531d..2b12780c 100644 --- a/test/base/StringUtilTest.cpp +++ b/test/base/StringUtilTest.cpp @@ -1,4 +1,3 @@ -#include "cru/base/String.h" #include "cru/base/StringUtil.h" #include <catch2/catch_test_macros.hpp> |