Add CopiedString and LinkedString

This commit is contained in:
Benoit Blanchon committed 2021-11-24 19:06:49 +01:00
1 parent b06bbd9d2a
commit 62f9b94ab1
13 files changed
+83 -50

No files matched your search

+3 -2
View File
@@ -19,7 +19,8 @@ TEST_CASE("StringCopier") {
str.append('\0');
REQUIRE(str.isValid() == true);
REQUIRE(str.c_str() == std::string("hello"));
REQUIRE(std::string(str.str()) == "hello");
REQUIRE(pool.overflowed() == false);
}
SECTION("Returns null when too small") {
@@ -49,7 +50,7 @@ static const char* addStringToPool(MemoryPool& pool, const char* s) {
str.startString();
str.append(s);
str.append('\0');
return str.save();
return str.save().c_str();
}
TEST_CASE("StringCopier::save() deduplicates strings") {
+1 -1
View File
@@ -19,7 +19,7 @@ static void testCodepoint(uint32_t codepoint, std::string expected) {
Utf8::encodeCodepoint(codepoint, str);
str.append('\0');
REQUIRE(str.c_str() == expected);
REQUIRE(str.str().c_str() == expected);
}
TEST_CASE("Utf8::encodeCodepoint()") {