summaryrefslogtreecommitdiff
path: root/test/test_string.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-04 09:56:12 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-04 09:56:12 -0600
commit0b400af9519444deef4cc6ad2c43c30e2092ab4f (patch)
treee6b0d78a2c292a7df5724f150e123b55d7871819 /test/test_string.cpp
parent253385f4bca5ccd2fee22fea8333dfe435c0df0a (diff)
Fix bug related to string copying.
Diffstat (limited to 'test/test_string.cpp')
-rw-r--r--test/test_string.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_string.cpp b/test/test_string.cpp
index ba2df6c..39a24cb 100644
--- a/test/test_string.cpp
+++ b/test/test_string.cpp
@@ -39,6 +39,7 @@ TEST(FudString, BasicStringOps)
ASSERT_FALSE(Ascii::valid(invalid[0]));
const Array<utf8, 2> invalid2{0xFF, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto stringResult = String::makeFromCString(reinterpret_cast<const char*>(invalid2.data()));
ASSERT_TRUE(stringResult.isOkay());
@@ -77,7 +78,9 @@ TEST(FudString, ViewFromCString)
TEST(FudString, HeapAlloc)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
constexpr const char filenameLiteral[] = "Amazing Saga Volume 01/000.jpg";
+ // NOLINTNEXTLINE
auto filenameResult{String::makeFromCString(filenameLiteral)};
ASSERT_TRUE(filenameResult.isOkay());
auto filename{filenameResult.takeOkay()};
@@ -92,6 +95,18 @@ TEST(FudString, Reserve)
ASSERT_TRUE(testString.utf8Valid());
}
+TEST(FudString, Equality)
+{
+ StringView levo{u8"a"};
+ StringView dextro{u8"a"};
+ ASSERT_EQ(levo, dextro);
+
+ levo = StringView{u8"z"};
+ dextro = StringView{u8"z"};
+ ASSERT_EQ(levo, dextro);
+ ASSERT_EQ(levo.length(), 1);
+}
+
#if 0
TEST(FudString, FindSubstringCxx)
{