From 0b400af9519444deef4cc6ad2c43c30e2092ab4f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sat, 4 Jan 2025 09:56:12 -0600 Subject: Fix bug related to string copying. --- test/test_string.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/test_string.cpp') 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 invalid2{0xFF, 0x00}; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) auto stringResult = String::makeFromCString(reinterpret_cast(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) { -- cgit v1.2.3