[libcxx-commits] [libcxx] c77cdba - Add `std::basic_string` test cases (#74830)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 12 12:42:04 PST 2023
Author: Tacet
Date: 2023-12-12T21:41:59+01:00
New Revision: c77cdbac9b121611121adf5806a99aff4812a40c
URL: https://github.com/llvm/llvm-project/commit/c77cdbac9b121611121adf5806a99aff4812a40c
DIFF: https://github.com/llvm/llvm-project/commit/c77cdbac9b121611121adf5806a99aff4812a40c.diff
LOG: Add `std::basic_string` test cases (#74830)
Extend `std::basic_string` tests to cover more buffer situations and
length in general, particularly non-SSO cases after SSO test cases
(changing buffers). This commit is a side effect of working on tests for
ASan annotations.
Related PR: https://github.com/llvm/llvm-project/pull/72677
Added:
Modified:
libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index ecde912dc39f48..b740901be1c4d5 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -39,6 +39,7 @@ template <class S>
void test_string() {
test<S>(0, 0);
test<S>(10, 5);
+ test<S>(100, 5);
test<S>(100, 50);
}
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
index bb804bf328b3b8..dfb3b270f750ec 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
@@ -64,6 +64,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test<S>(0, 0, 50);
}
{
+ test<S>(100, 1, 5);
test<S>(100, 50, 5);
test<S>(100, 50, 10);
test<S>(100, 50, 50);
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
index 1efebfc9cea561..66eefdd383dc08 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
@@ -36,6 +36,10 @@ TEST_CONSTEXPR_CXX20 void test_string() {
s.erase(5);
test(s);
+ s.assign(50, 'a');
+ s.erase(5);
+ test(s);
+
s.assign(100, 'a');
s.erase(50);
test(s);
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
index 8d0fcb3c6d2943..eb522aafa24302 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
@@ -35,6 +35,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S(), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("123456789"), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), S("123456789"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
index 89cb44d62ef2b6..cb0fe0396cb790 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
@@ -40,6 +40,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S(), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("123456789"), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), S("123456789"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
index 4b3027a2aad118..eb3296d60403b6 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
@@ -37,6 +37,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S(), "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
test(S("123456789"), "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+ test(S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), "123456789");
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
index 3c88f9e40fc0b3..b41d1336fd134c 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
@@ -37,6 +37,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S(), SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("123456789"), SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ test(S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), SV("123456789"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"),
SV("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
index cf45b368ebbcaf..e43c36c31e483b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
@@ -80,6 +80,11 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), SV(), 0, 0, S("12345678901234567890"));
test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234"));
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("123456789012345678906789012345"));
+
+ // Starting from long string (no SSO)
+ test(S("1234512345678901234567890"), SV(), 0, 0, S("1234512345678901234567890"));
+ test(S("1234512345678901234567890"), SV("12345"), 1, 3, S("1234512345678901234567890234"));
+ test(S("1234512345678901234567890"), SV("12345678901234567890"), 5, 10, S("12345123456789012345678906789012345"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
index 0b8e5f65c15e94..120de4fef74062 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
@@ -68,6 +68,10 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S(), 'a', S(1, 'a'));
test(S("12345"), 'a', S("12345a"));
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
+ test(S("123abcabcdefghabcdefgh"), 'a', S("123abcabcdefghabcdefgha"));
+ test(S("123abcabcdefghabcdefgha"), 'b', S("123abcabcdefghabcdefghab"));
+ test(S("123abcabcdefghabcdefghab"), 'c', S("123abcabcdefghabcdefghabc"));
+ test(S("123abcabcdefghabcdefghabc"), 'd', S("123abcabcdefghabcdefghabcd"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
index eb0728456df5be..86072efc09cd47 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
@@ -38,6 +38,11 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), 0, 'a', S("12345678901234567890"));
test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a"));
test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa"));
+
+ // Starting from long string (no SSO)
+ test(S("1234567890123456789012345678901234567890"), 0, 'a', S("1234567890123456789012345678901234567890"));
+ test(S("1234567890123456789012345678901234567890"), 1, 'a', S("1234567890123456789012345678901234567890a"));
+ test(S("1234567890123456789012345678901234567890"), 10, 'a', S("1234567890123456789012345678901234567890aaaaaaaaaa"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
index 21f2ff53004d15..9d6237507e8a3c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
@@ -45,6 +45,14 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345"));
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("123456789012345678901234567890"), S(), S("123456789012345678901234567890"));
+ test(S("123456789012345678901234567890"), S("12345"), S("12345678901234567890123456789012345"));
+ test(S("123456789012345678901234567890"), S("1234567890"), S("1234567890123456789012345678901234567890"));
+ test(S("123456789012345678901234567890"),
+ S("12345678901234567890"),
+ S("12345678901234567890123456789012345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index 902d29c53ac69f..5b578a1a0bf8d9 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -79,6 +79,15 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), S(), 0, 0, S("12345678901234567890"));
test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234"));
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("123456789012345678906789012345"));
+
+ // Starting from long string (no SSO)
+ test(S("123456789012345678901234567890"), S(), 0, 0, S("123456789012345678901234567890"));
+ test(S("123456789012345678901234567890"), S("12345"), 1, 3, S("123456789012345678901234567890234"));
+ test(S("123456789012345678901234567890"),
+ S("12345678901234567890"),
+ 5,
+ 10,
+ S("1234567890123456789012345678906789012345"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
index c09cdde1bc105e..9de48ca2463e2f 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
@@ -47,6 +47,14 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), SV("12345"), S("1234567890123456789012345"));
test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
test(S("12345678901234567890"), SV("12345678901234567890"), S("1234567890123456789012345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("123456789012345678901234567890"), SV(), S("123456789012345678901234567890"));
+ test(S("123456789012345678901234567890"), SV("12345"), S("12345678901234567890123456789012345"));
+ test(S("123456789012345678901234567890"), SV("1234567890"), S("1234567890123456789012345678901234567890"));
+ test(S("123456789012345678901234567890"),
+ SV("12345678901234567890"),
+ S("12345678901234567890123456789012345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
index 11e12c318a2e80..175062c91a8835 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
@@ -37,6 +37,11 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), "", S());
test(S("12345678901234567890"), "12345", S("12345"));
test(S("12345678901234567890"), "12345678901234567890", S("12345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("1234512345678901234567890"), "", S());
+ test(S("1234512345678901234567890"), "12345", S("12345"));
+ test(S("1234512345678901234567890"), "12345678901234567890", S("12345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
index 2738a9a6ffad59..851f016829c3f1 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
@@ -42,6 +42,12 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), "", 0, S());
test(S("12345678901234567890"), "12345", 5, S("12345"));
test(S("12345678901234567890"), "12345678901234567890", 20, S("12345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("1234512345678901234567890"), "", 0, S());
+ test(S("1234512345678901234567890"), "12345", 5, S("12345"));
+ test(S("1234512345678901234567890"), "12345678901234567890", 20, S("12345678901234567890"));
+ test(S("1234512345678901234567890"), "123451234512345678901234567890", 30, S("123451234512345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index e1904baeb9033b..1bd686c5edbf84 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -102,6 +102,8 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("abcdefghijklmnopqrst"), s, 20, 0);
test(S("abcdefghijklmnopqrst"), s, 20, 1);
test(S("abcdefghijklmnopqrst"), s, 21, 0);
+ test(S("abcdefghijklmnopqrstabcdefghijklmnopqrst"), s, 40, 1);
+ test(S("abcdefghijklmnopqrstabcdefghijklmnopqrst"), s, 40, 0);
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
index bc3ce511ab5c22..eb1c10b070a2cf 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
@@ -47,6 +47,23 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(s, s.begin() + 4, 'A', S("a567A1432dcb"));
test(s, s.begin() + 5, 'B', S("a567AB1432dcb"));
test(s, s.begin() + 6, 'C', S("a567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin(), 'x', S("xxxxxxxxxxxxxxxxa567ABC1432dcb"));
+ test(s, s.begin() + 1, 'x', S("xxxxxxxxxxxxxxxxxa567ABC1432dcb"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
index 1e03d8c1b61474..3d5e2c0cbf6995 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
@@ -29,6 +29,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345"), 'a', S("12345a"));
test(S("1234567890"), 'a', S("1234567890a"));
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
+ test(S("1234567890123456789012345678901234567890"), 'a', S("1234567890123456789012345678901234567890a"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
index 2d8c535b354c22..ba14b3831778f5 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
@@ -44,6 +44,16 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890"));
test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("1234567890123456789012345678901234567890"), "", S("1234567890123456789012345678901234567890"));
+ test(S("1234567890123456789012345678901234567890"), "12345", S("123456789012345678901234567890123456789012345"));
+ test(S("1234567890123456789012345678901234567890"),
+ "12345678901234567890",
+ S("123456789012345678901234567890123456789012345678901234567890"));
+ test(S("1234567890123456789012345678901234567890"),
+ "1234567890123456789012345678901234567890",
+ S("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
index e02ced737ae16a..59c76ece67c66a 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
@@ -45,6 +45,16 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345"));
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890"));
+
+ // Starting from long string (no SSO)
+ test(S("1234567890123456789012345678901234567890"), S(), S("1234567890123456789012345678901234567890"));
+ test(S("1234567890123456789012345678901234567890"), S("12345"), S("123456789012345678901234567890123456789012345"));
+ test(S("1234567890123456789012345678901234567890"),
+ S("12345678901234567890"),
+ S("123456789012345678901234567890123456789012345678901234567890"));
+ test(S("1234567890123456789012345678901234567890"),
+ S("1234567890123456789012345678901234567890"),
+ S("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
index da6fc11c14329f..376637e3efc942 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
@@ -49,6 +49,10 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("abcdefghijklmnopqrst"), S("12345"));
test(S("abcdefghijklmnopqrst"), S("1234567890"));
test(S("abcdefghijklmnopqrst"), S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst123456LONG1234567890"), S(""));
+ test(S("abcdefghijklmnopqrst123456LONG1234567890"), S("12345"));
+ test(S("abcdefghijklmnopqrst123456LONG1234567890"), S("1234567890"));
+ test(S("abcdefghijklmnopqrst123456LONG1234567890"), S("12345678901234567890"));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index 83cfa8737408ca..9b8b7a8a223d8c 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -102,6 +102,15 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(S("ktsrmnqagdecfhijpobl"), 19, 1);
test(S("lsaijeqhtrbgcdmpfkno"), 20, 0);
test(S("dplqartnfgejichmoskb"), 21, 0);
+ test(S("gbmetiprqdoasckjfhlnxx"), 0, 22);
+ test(S("gbmetiprqdoasckjfhlnxa"), 0, 8);
+ test(S("gbmetiprqdoasckjfhlnxb"), 1, 0);
+ test(S("LONGtiprqdoasckjfhlnxxo"), 0, 23);
+ test(S("LONGtiprqdoasckjfhlnxap"), 0, 8);
+ test(S("LONGtiprqdoasckjfhlnxbl"), 1, 0);
+ test(S("LONGtiprqdoasckjfhlnxxyy"), 0, 24);
+ test(S("LONGtiprqdoasckjfhlnxxyr"), 0, 8);
+ test(S("LONGtiprqdoasckjfhlnxxyz"), 1, 0);
}
TEST_CONSTEXPR_CXX20 bool test() {
More information about the libcxx-commits
mailing list