[libc++] Apply clang formatting to all string unit tests
This applies clang-format to the std::string unit tests in preparation for landing https://reviews.llvm.org/D140550. Differential Revision: https://reviews.llvm.org/D140612
This commit is contained in:
committed by
Louis Dionne
parent
823151f0cf
commit
a40bada91a
@@ -14,29 +14,31 @@
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Incomplete;
|
||||
template<class T> struct Holder { T t; };
|
||||
template <class T>
|
||||
struct Holder {
|
||||
T t;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
struct Charlike {
|
||||
char ch_;
|
||||
TEST_CONSTEXPR Charlike(char ch) : ch_(ch) {}
|
||||
TEST_CONSTEXPR operator char() const { return ch_; }
|
||||
char ch_;
|
||||
TEST_CONSTEXPR Charlike(char ch) : ch_(ch) {}
|
||||
TEST_CONSTEXPR operator char() const { return ch_; }
|
||||
};
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
std::string s;
|
||||
Charlike<Holder<Incomplete> > a[] = {'m', 'a', 'h', 'i'};
|
||||
s.append(a, a+4);
|
||||
s.assign(a, a+4);
|
||||
s.insert(s.begin(), a, a+4);
|
||||
s.replace(s.begin(), s.begin()+4, a, a+4);
|
||||
s.append(a, a + 4);
|
||||
s.assign(a, a + 4);
|
||||
s.insert(s.begin(), a, a + 4);
|
||||
s.replace(s.begin(), s.begin() + 4, a, a + 4);
|
||||
assert(s == "mahimahi");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -20,54 +20,40 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
s.append(sv, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected) {
|
||||
if (pos <= sv.size()) {
|
||||
s.append(sv, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.append(sv, pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.append(sv, pos, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, SV sv, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
s.append(sv, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test_npos(S s, SV sv, typename S::size_type pos, S expected) {
|
||||
if (pos <= sv.size()) {
|
||||
s.append(sv, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.append(sv, pos);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.append(sv, pos);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -93,8 +79,7 @@ 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"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("123456789012345678906789012345"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -118,9 +103,9 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
{
|
||||
std::string s;
|
||||
std::string_view sv = "EFGH";
|
||||
char arr[] = "IJKL";
|
||||
char arr[] = "IJKL";
|
||||
|
||||
s.append("CDEF", 0); // calls append(const char *, len)
|
||||
s.append("CDEF", 0); // calls append(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
|
||||
@@ -128,29 +113,29 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
assert(s == "QRST");
|
||||
s.clear();
|
||||
|
||||
s.append(sv, 0); // calls append(T, pos, npos)
|
||||
s.append(sv, 0); // calls append(T, pos, npos)
|
||||
assert(s == sv);
|
||||
s.clear();
|
||||
|
||||
s.append(sv, 0, std::string::npos); // calls append(T, pos, npos)
|
||||
s.append(sv, 0, std::string::npos); // calls append(T, pos, npos)
|
||||
assert(s == sv);
|
||||
s.clear();
|
||||
|
||||
s.append(arr, 0); // calls append(const char *, len)
|
||||
s.append(arr, 0); // calls append(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
|
||||
s.append(arr, 0, std::string::npos); // calls append(string("IJKL"), pos, npos)
|
||||
s.append(arr, 0, std::string::npos); // calls append(string("IJKL"), pos, npos)
|
||||
assert(s == "IJKL");
|
||||
s.clear();
|
||||
|
||||
s.append(arr, 0); // calls append(const char *, len)
|
||||
s.append(arr, 0); // calls append(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
}
|
||||
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = s;
|
||||
s.append(sv);
|
||||
assert(s == "ABCDABCD");
|
||||
@@ -165,20 +150,20 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string_view sv = s;
|
||||
s.append(sv);
|
||||
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
|
||||
sv = s;
|
||||
s.append(sv, 0, std::string::npos);
|
||||
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
assert(s ==
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -43,9 +43,7 @@ int main(int, char**) {
|
||||
|
||||
{ // Check that `append_range` returns a reference to the string.
|
||||
std::string c;
|
||||
static_assert(std::is_lvalue_reference_v<decltype(
|
||||
c.append_range(FullContainer_Begin_EmptyRange<char>.input)
|
||||
)>);
|
||||
static_assert(std::is_lvalue_reference_v<decltype(c.append_range(FullContainer_Begin_EmptyRange<char>.input))>);
|
||||
assert(&c.append_range(FullContainer_Begin_EmptyRange<char>.input) == &c);
|
||||
assert(&c.append_range(FullContainer_Begin_OneElementRange<char>.input) == &c);
|
||||
assert(&c.append_range(FullContainer_Begin_MidRange<char>.input) == &c);
|
||||
|
||||
@@ -19,36 +19,35 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class It>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, It first, It last, S expected)
|
||||
{
|
||||
s.append(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, It first, It last, S expected) {
|
||||
s.append(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
struct Widget {
|
||||
operator char() const { throw 42; }
|
||||
};
|
||||
|
||||
template <class S, class It>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_exceptions(S s, It first, It last)
|
||||
{
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
TEST_CONSTEXPR_CXX20 void test_exceptions(S s, It first, It last) {
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
|
||||
try {
|
||||
s.append(first, last);
|
||||
assert(false);
|
||||
} catch (...) {}
|
||||
try {
|
||||
s.append(first, last);
|
||||
assert(false);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -56,59 +55,89 @@ template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
test(S(), s, s+1, S("A"));
|
||||
test(S(), s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), s, s + 1, S("A"));
|
||||
test(S(), s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S(), s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), s, s, S("12345"));
|
||||
test(S("12345"), s, s+1, S("12345A"));
|
||||
test(S("12345"), s, s+10, S("12345ABCDEFGHIJ"));
|
||||
test(S("12345"), s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), s, s + 1, S("12345A"));
|
||||
test(S("12345"), s, s + 10, S("12345ABCDEFGHIJ"));
|
||||
test(S("12345"), s, s + 52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), s, s, S("1234567890"));
|
||||
test(S("1234567890"), s, s+1, S("1234567890A"));
|
||||
test(S("1234567890"), s, s+10, S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), s, s+52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("1234567890"), s, s + 1, S("1234567890A"));
|
||||
test(S("1234567890"), s, s + 10, S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), s, s + 52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345678901234567890"), s, s, S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), s, s+1, S("12345678901234567890""A"));
|
||||
test(S("12345678901234567890"), s, s+10, S("12345678901234567890""ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), s, s+52,
|
||||
S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"),
|
||||
s,
|
||||
s + 1,
|
||||
S("12345678901234567890"
|
||||
"A"));
|
||||
test(S("12345678901234567890"),
|
||||
s,
|
||||
s + 10,
|
||||
S("12345678901234567890"
|
||||
"ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"),
|
||||
s,
|
||||
s + 52,
|
||||
S("12345678901234567890"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("A"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("A"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 10), S("ABCDEFGHIJ"));
|
||||
test(S(),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S("12345"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("12345A"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("12345ABCDEFGHIJ"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S("12345"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("12345A"));
|
||||
test(S("12345"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("12345ABCDEFGHIJ"));
|
||||
test(S("12345"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S("1234567890"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("1234567890A"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S("1234567890"));
|
||||
test(S("1234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 1),
|
||||
S("1234567890A"));
|
||||
test(S("1234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("12345678901234567890""A"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("12345678901234567890""ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 1),
|
||||
S("12345678901234567890"
|
||||
"A"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("12345678901234567890"
|
||||
"ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("12345678901234567890"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -123,16 +152,16 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
|
||||
test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 6, TIter::TAComparison), TIter());
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), w, w+100);
|
||||
test_exceptions(S(), w, w + 100);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -162,23 +191,24 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
}
|
||||
|
||||
{ // regression-test appending to self in sneaky ways
|
||||
std::string s_short = "hello";
|
||||
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
std::string s_short = "hello";
|
||||
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
std::string s_othertype = "hello";
|
||||
std::string s_sneaky = "hello";
|
||||
std::string s_sneaky = "hello";
|
||||
|
||||
test(s_short, s_short.data() + s_short.size(), s_short.data() + s_short.size() + 1,
|
||||
std::string("hello\0", 6));
|
||||
test(s_long, s_long.data() + s_long.size(), s_long.data() + s_long.size() + 1,
|
||||
test(s_short, s_short.data() + s_short.size(), s_short.data() + s_short.size() + 1, std::string("hello\0", 6));
|
||||
test(s_long,
|
||||
s_long.data() + s_long.size(),
|
||||
s_long.data() + s_long.size() + 1,
|
||||
std::string("Lorem ipsum dolor sit amet, consectetur/\0", 41));
|
||||
|
||||
s_sneaky.reserve(12);
|
||||
test(s_sneaky, s_sneaky.data(), s_sneaky.data() + 6, std::string("hellohello\0", 11));
|
||||
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
const unsigned char *first = reinterpret_cast<const unsigned char*>(s_othertype.data());
|
||||
test(s_othertype, first + 2, first + 5, std::string("hellollo"));
|
||||
}
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
const unsigned char* first = reinterpret_cast<const unsigned char*>(s_othertype.data());
|
||||
test(s_othertype, first + 2, first + 5, std::string("hellollo"));
|
||||
}
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
@@ -201,8 +231,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, S expected)
|
||||
{
|
||||
s.append(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expected) {
|
||||
s.append(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -38,8 +36,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
|
||||
test(S("12345678901234567890"), "", S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -66,8 +63,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
|
||||
{
|
||||
s.append(str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) {
|
||||
s.append(str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -43,8 +41,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
|
||||
test(S("12345678901234567890"), "", 0, S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20,
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20, S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -72,8 +69,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -23,46 +23,44 @@ struct VeryLarge {
|
||||
};
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
struct char_traits<VeryLarge> {
|
||||
using char_type = VeryLarge;
|
||||
using int_type = int;
|
||||
using off_type = streamoff;
|
||||
using pos_type = streampos;
|
||||
using state_type = mbstate_t;
|
||||
template <>
|
||||
struct char_traits<VeryLarge> {
|
||||
using char_type = VeryLarge;
|
||||
using int_type = int;
|
||||
using off_type = streamoff;
|
||||
using pos_type = streampos;
|
||||
using state_type = mbstate_t;
|
||||
|
||||
static TEST_CONSTEXPR_CXX20 void assign(char_type& c1, const char_type& c2) { c1 = c2; }
|
||||
static bool eq(char_type c1, char_type c2);
|
||||
static bool lt(char_type c1, char_type c2);
|
||||
static TEST_CONSTEXPR_CXX20 void assign(char_type& c1, const char_type& c2) { c1 = c2; }
|
||||
static bool eq(char_type c1, char_type c2);
|
||||
static bool lt(char_type c1, char_type c2);
|
||||
|
||||
static int compare(const char_type* s1, const char_type* s2, std::size_t n);
|
||||
static std::size_t length(const char_type* s);
|
||||
static const char_type* find(const char_type* s, std::size_t n, const char_type& a);
|
||||
static char_type* move(char_type* s1, const char_type* s2, std::size_t n);
|
||||
static TEST_CONSTEXPR_CXX20 char_type* copy(char_type* s1, const char_type* s2, std::size_t n) {
|
||||
std::copy_n(s2, n, s1);
|
||||
return s1;
|
||||
}
|
||||
static TEST_CONSTEXPR_CXX20 char_type* assign(char_type* s, std::size_t n, char_type a) {
|
||||
std::fill_n(s, n, a);
|
||||
return s;
|
||||
}
|
||||
static int compare(const char_type* s1, const char_type* s2, std::size_t n);
|
||||
static std::size_t length(const char_type* s);
|
||||
static const char_type* find(const char_type* s, std::size_t n, const char_type& a);
|
||||
static char_type* move(char_type* s1, const char_type* s2, std::size_t n);
|
||||
static TEST_CONSTEXPR_CXX20 char_type* copy(char_type* s1, const char_type* s2, std::size_t n) {
|
||||
std::copy_n(s2, n, s1);
|
||||
return s1;
|
||||
}
|
||||
static TEST_CONSTEXPR_CXX20 char_type* assign(char_type* s, std::size_t n, char_type a) {
|
||||
std::fill_n(s, n, a);
|
||||
return s;
|
||||
}
|
||||
|
||||
static int_type not_eof(int_type c);
|
||||
static char_type to_char_type(int_type c);
|
||||
static int_type to_int_type(char_type c);
|
||||
static bool eq_int_type(int_type c1, int_type c2);
|
||||
static int_type eof();
|
||||
};
|
||||
static int_type not_eof(int_type c);
|
||||
static char_type to_char_type(int_type c);
|
||||
static int_type to_int_type(char_type c);
|
||||
static bool eq_int_type(int_type c1, int_type c2);
|
||||
static int_type eof();
|
||||
};
|
||||
} // end namespace std
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::value_type c, S expected)
|
||||
{
|
||||
s.push_back(c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type c, S expected) {
|
||||
s.push_back(c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -93,8 +91,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
{
|
||||
s.append(n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_type c, S expected) {
|
||||
s.append(n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -51,8 +49,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.append(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) {
|
||||
s.append(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -46,8 +44,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), S(), S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -57,7 +54,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s.append({"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
@@ -68,8 +65,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -20,54 +20,40 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
{
|
||||
s.append(str, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) {
|
||||
if (pos <= str.size()) {
|
||||
s.append(str, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.append(str, pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.append(str, pos, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
{
|
||||
s.append(str, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test_npos(S s, S str, typename S::size_type pos, S expected) {
|
||||
if (pos <= str.size()) {
|
||||
s.append(str, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.append(str, pos);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.append(str, pos);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -92,8 +78,7 @@ 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"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("123456789012345678906789012345"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -116,8 +101,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, S expected)
|
||||
{
|
||||
s.append(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, SV sv, S expected) {
|
||||
s.append(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -48,8 +46,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), SV(), S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345"), S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -61,8 +58,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,54 +19,40 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
s.assign(sv, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected) {
|
||||
if (pos <= sv.size()) {
|
||||
s.assign(sv, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.assign(sv, pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.assign(sv, pos, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, SV sv, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
s.assign(sv, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test_npos(S s, SV sv, typename S::size_type pos, S expected) {
|
||||
if (pos <= sv.size()) {
|
||||
s.assign(sv, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.assign(sv, pos);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.assign(sv, pos);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -92,8 +78,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
|
||||
test(S("12345678901234567890"), SV(), 0, 0, S());
|
||||
test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("6789012345"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -115,11 +100,11 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = "EFGH";
|
||||
char arr[] = "IJKL";
|
||||
char arr[] = "IJKL";
|
||||
|
||||
s.assign("CDEF", 0); // calls assign(const char *, len)
|
||||
s.assign("CDEF", 0); // calls assign(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
|
||||
@@ -127,29 +112,29 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
assert(s == "QRST");
|
||||
s.clear();
|
||||
|
||||
s.assign(sv, 0); // calls assign(T, pos, npos)
|
||||
s.assign(sv, 0); // calls assign(T, pos, npos)
|
||||
assert(s == sv);
|
||||
s.clear();
|
||||
|
||||
s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
|
||||
s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
|
||||
assert(s == sv);
|
||||
s.clear();
|
||||
|
||||
s.assign(arr, 0); // calls assign(const char *, len)
|
||||
s.assign(arr, 0); // calls assign(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
|
||||
s.assign(arr, 0, std::string::npos); // calls assign(string("IJKL"), pos, npos)
|
||||
s.assign(arr, 0, std::string::npos); // calls assign(string("IJKL"), pos, npos)
|
||||
assert(s == "IJKL");
|
||||
s.clear();
|
||||
|
||||
s.assign(arr, 0); // calls assign(const char *, len)
|
||||
s.assign(arr, 0); // calls assign(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
}
|
||||
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = s;
|
||||
s.assign(sv);
|
||||
assert(s == "ABCD");
|
||||
@@ -160,7 +145,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string_view sv = s;
|
||||
s.assign(sv);
|
||||
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
@@ -172,8 +157,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -43,9 +43,7 @@ int main(int, char**) {
|
||||
|
||||
{ // Check that `assign_range` returns a reference to the string.
|
||||
std::string c;
|
||||
static_assert(std::is_lvalue_reference_v<decltype(
|
||||
c.assign_range(FullContainer_Begin_EmptyRange<char>.input)
|
||||
)>);
|
||||
static_assert(std::is_lvalue_reference_v<decltype(c.assign_range(FullContainer_Begin_EmptyRange<char>.input))>);
|
||||
assert(&c.assign_range(FullContainer_Begin_EmptyRange<char>.input) == &c);
|
||||
assert(&c.assign_range(FullContainer_Begin_OneElementRange<char>.input) == &c);
|
||||
assert(&c.assign_range(FullContainer_Begin_MidRange<char>.input) == &c);
|
||||
|
||||
@@ -34,8 +34,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,36 +19,35 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class It>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, It first, It last, S expected)
|
||||
{
|
||||
s.assign(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, It first, It last, S expected) {
|
||||
s.assign(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
struct Widget {
|
||||
operator char() const { throw 42; }
|
||||
};
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
test_exceptions(S s, It first, It last)
|
||||
{
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
void test_exceptions(S s, It first, It last) {
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
|
||||
try {
|
||||
s.assign(first, last);
|
||||
assert(false);
|
||||
} catch (...) {}
|
||||
try {
|
||||
s.assign(first, last);
|
||||
assert(false);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -56,59 +55,65 @@ template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
test(S(), s, s+1, S("A"));
|
||||
test(S(), s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), s, s + 1, S("A"));
|
||||
test(S(), s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S(), s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), s, s, S());
|
||||
test(S("12345"), s, s+1, S("A"));
|
||||
test(S("12345"), s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S("12345"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), s, s + 1, S("A"));
|
||||
test(S("12345"), s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S("12345"), s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), s, s, S());
|
||||
test(S("1234567890"), s, s+1, S("A"));
|
||||
test(S("1234567890"), s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S("1234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("1234567890"), s, s + 1, S("A"));
|
||||
test(S("1234567890"), s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S("1234567890"), s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345678901234567890"), s, s, S());
|
||||
test(S("12345678901234567890"), s, s+1, S("A"));
|
||||
test(S("12345678901234567890"), s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), s, s+52,
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"), s, s + 1, S("A"));
|
||||
test(S("12345678901234567890"), s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("A"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("A"));
|
||||
test(S(), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 10), S("ABCDEFGHIJ"));
|
||||
test(S(),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S());
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("A"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("A"));
|
||||
test(S("12345"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 10), S("ABCDEFGHIJ"));
|
||||
test(S("12345"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S());
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("A"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S("1234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("A"));
|
||||
test(S("1234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("1234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s),
|
||||
S());
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1),
|
||||
S("A"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 1),
|
||||
S("A"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -123,16 +128,16 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), IIter(TIter(s, s + 10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
|
||||
test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), TIter(s, s + 10, 6, TIter::TAComparison), TIter());
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), w, w+100);
|
||||
test_exceptions(S(), w, w + 100);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -171,12 +176,11 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, S expected)
|
||||
{
|
||||
s.assign(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expected) {
|
||||
s.assign(str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -38,8 +36,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
|
||||
test(S("12345678901234567890"), "", S());
|
||||
test(S("12345678901234567890"), "12345", S("12345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", S("12345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -65,8 +62,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
|
||||
{
|
||||
s.assign(str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) {
|
||||
s.assign(str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -43,8 +41,7 @@ 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"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20, S("12345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -66,14 +63,13 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
s_long.assign(s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
|
||||
|
||||
s_long.assign(s_long.data() + 2, 8 );
|
||||
s_long.assign(s_long.data() + 2, 8);
|
||||
assert(s_long == "rem ipsu");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.assign(std::move(str));
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) {
|
||||
s.assign(std::move(str));
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -47,8 +45,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), S(), S());
|
||||
test(S("12345678901234567890"), S("12345"), S("12345"));
|
||||
test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), S("12345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -60,8 +57,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
{
|
||||
s.assign(n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_type c, S expected) {
|
||||
s.assign(n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -51,8 +49,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -27,72 +27,70 @@ TEST_CONSTEXPR_CXX20 void test(S dest, S src) {
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
testAlloc(S dest, S src, const typename S::allocator_type& a)
|
||||
{
|
||||
dest.assign(src);
|
||||
LIBCPP_ASSERT(dest.__invariants());
|
||||
assert(dest == src);
|
||||
assert(dest.get_allocator() == a);
|
||||
TEST_CONSTEXPR_CXX20 void testAlloc(S dest, S src, const typename S::allocator_type& a) {
|
||||
dest.assign(src);
|
||||
LIBCPP_ASSERT(dest.__invariants());
|
||||
assert(dest == src);
|
||||
assert(dest.get_allocator() == a);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test_assign() {
|
||||
using CharT = typename S::value_type;
|
||||
using CharT = typename S::value_type;
|
||||
|
||||
test(S(), S());
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
test(S(), S());
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "1234567890")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S());
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "12345")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "1234567890")));
|
||||
test(S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")), S(CONVERT_TO_CSTRING(CharT, "12345678901234567890")));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
test_assign<std::string>();
|
||||
test_assign<std::string>();
|
||||
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
||||
test_assign<std::wstring>();
|
||||
test_assign<std::wstring>();
|
||||
#endif
|
||||
#if TEST_STD_VER >= 20
|
||||
test_assign<std::u8string>();
|
||||
test_assign<std::u8string>();
|
||||
#endif
|
||||
#if TEST_STD_VER >= 11
|
||||
test_assign<std::u16string>();
|
||||
test_assign<std::u32string>();
|
||||
test_assign<std::u16string>();
|
||||
test_assign<std::u32string>();
|
||||
#endif
|
||||
#ifndef TEST_HAS_NO_NASTY_STRING
|
||||
test_assign<nasty_string>();
|
||||
test_assign<nasty_string>();
|
||||
#endif
|
||||
|
||||
{
|
||||
typedef std::string S;
|
||||
testAlloc(S(), S(), std::allocator<char>());
|
||||
testAlloc(S(), S("12345"), std::allocator<char>());
|
||||
testAlloc(S(), S("1234567890"), std::allocator<char>());
|
||||
testAlloc(S(), S("12345678901234567890"), std::allocator<char>());
|
||||
}
|
||||
{
|
||||
typedef std::string S;
|
||||
testAlloc(S(), S(), std::allocator<char>());
|
||||
testAlloc(S(), S("12345"), std::allocator<char>());
|
||||
testAlloc(S(), S("1234567890"), std::allocator<char>());
|
||||
testAlloc(S(), S("12345678901234567890"), std::allocator<char>());
|
||||
}
|
||||
|
||||
{ // LWG#5579 make sure assign takes the allocators where appropriate
|
||||
typedef other_allocator<char> A; // has POCCA --> true
|
||||
typedef std::basic_string<char, std::char_traits<char>, A> S;
|
||||
testAlloc(S(A(5)), S(A(3)), A(3));
|
||||
testAlloc(S(A(5)), S("1"), A());
|
||||
testAlloc(S(A(5)), S("1", A(7)), A(7));
|
||||
testAlloc(S(A(5)), S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), A(7));
|
||||
}
|
||||
{ // LWG#5579 make sure assign takes the allocators where appropriate
|
||||
typedef other_allocator<char> A; // has POCCA --> true
|
||||
typedef std::basic_string<char, std::char_traits<char>, A> S;
|
||||
testAlloc(S(A(5)), S(A(3)), A(3));
|
||||
testAlloc(S(A(5)), S("1"), A());
|
||||
testAlloc(S(A(5)), S("1", A(7)), A(7));
|
||||
testAlloc(S(A(5)), S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), A(7));
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
@@ -107,15 +105,14 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
#if TEST_STD_VER > 14
|
||||
{
|
||||
typedef std::string S;
|
||||
static_assert(noexcept(S().assign(S())), ""); // LWG#2063
|
||||
static_assert(noexcept(S().assign(S())), ""); // LWG#2063
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -20,54 +20,40 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
{
|
||||
s.assign(str, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) {
|
||||
if (pos <= str.size()) {
|
||||
s.assign(str, pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.assign(str, pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.assign(str, pos, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
{
|
||||
s.assign(str, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test_npos(S s, S str, typename S::size_type pos, S expected) {
|
||||
if (pos <= str.size()) {
|
||||
s.assign(str, pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.assign(str, pos);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.assign(str, pos);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -92,8 +78,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
|
||||
test(S("12345678901234567890"), S(), 0, 0, S());
|
||||
test(S("12345678901234567890"), S("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("6789012345"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -116,8 +101,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -20,22 +20,18 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, S expected)
|
||||
{
|
||||
s.assign(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, SV sv, S expected) {
|
||||
s.assign(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
testAlloc(S s, SV sv, const typename S::allocator_type& a)
|
||||
{
|
||||
s.assign(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == sv);
|
||||
assert(s.get_allocator() == a);
|
||||
TEST_CONSTEXPR_CXX20 void testAlloc(S s, SV sv, const typename S::allocator_type& a) {
|
||||
s.assign(sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == sv);
|
||||
assert(s.get_allocator() == a);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -59,8 +55,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), SV(), S());
|
||||
test(S("12345678901234567890"), SV("12345"), S("12345"));
|
||||
test(S("12345678901234567890"), SV("1234567890"), S("1234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"),
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), S("12345678901234567890"));
|
||||
|
||||
using A = typename S::allocator_type;
|
||||
|
||||
@@ -79,8 +74,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,33 +19,25 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S str, typename S::value_type* s, typename S::size_type n,
|
||||
typename S::size_type pos)
|
||||
{
|
||||
const S& cs = str;
|
||||
if (pos <= cs.size())
|
||||
{
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
typename S::size_type rlen = std::min(n, cs.size() - pos);
|
||||
assert(r == rlen);
|
||||
for (r = 0; r < rlen; ++r)
|
||||
assert(S::traits_type::eq(cs[pos+r], s[r]));
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S str, typename S::value_type* s, typename S::size_type n, typename S::size_type pos) {
|
||||
const S& cs = str;
|
||||
if (pos <= cs.size()) {
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
typename S::size_type rlen = std::min(n, cs.size() - pos);
|
||||
assert(r == rlen);
|
||||
for (r = 0; r < rlen; ++r)
|
||||
assert(S::traits_type::eq(cs[pos + r], s[r]));
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
((void)r); // Prevent unused warning
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
((void)r); // Prevent unused warning
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -121,8 +113,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -17,15 +17,13 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, S expected)
|
||||
{
|
||||
typename S::const_iterator p = s.begin() + pos;
|
||||
typename S::iterator i = s.erase(p);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, S expected) {
|
||||
typename S::const_iterator p = s.begin() + pos;
|
||||
typename S::iterator i = s.erase(p);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -53,8 +51,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -17,16 +17,14 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, typename S::difference_type n, S expected)
|
||||
{
|
||||
typename S::const_iterator first = s.cbegin() + pos;
|
||||
typename S::const_iterator last = s.cbegin() + pos + n;
|
||||
typename S::iterator i = s.erase(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, typename S::difference_type n, S expected) {
|
||||
typename S::const_iterator first = s.cbegin() + pos;
|
||||
typename S::const_iterator last = s.cbegin() + pos + n;
|
||||
typename S::iterator i = s.erase(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -96,8 +94,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S expected)
|
||||
{
|
||||
s.pop_back();
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S expected) {
|
||||
s.pop_back();
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -42,8 +40,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,73 +19,57 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.erase(pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.erase(pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.erase(pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.erase(pos);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S expected)
|
||||
{
|
||||
s.erase();
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.erase(pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.erase(pos, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.erase(pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.erase(pos);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S expected) {
|
||||
s.erase();
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -201,8 +185,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,18 +18,16 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S& s, typename S::const_iterator p, typename S::value_type c, S expected)
|
||||
{
|
||||
bool sufficient_cap = s.size() < s.capacity();
|
||||
typename S::difference_type pos = p - s.begin();
|
||||
typename S::iterator i = s.insert(p, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
assert(*i == c);
|
||||
if (sufficient_cap)
|
||||
assert(i == p);
|
||||
TEST_CONSTEXPR_CXX20 void test(S& s, typename S::const_iterator p, typename S::value_type c, S expected) {
|
||||
bool sufficient_cap = s.size() < s.capacity();
|
||||
typename S::difference_type pos = p - s.begin();
|
||||
typename S::iterator i = s.insert(p, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
assert(*i == c);
|
||||
if (sufficient_cap)
|
||||
assert(i == p);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -38,17 +36,17 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(s, s.begin(), '1', S("1"));
|
||||
test(s, s.begin(), 'a', S("a1"));
|
||||
test(s, s.end(), 'b', S("a1b"));
|
||||
test(s, s.end()-1, 'c', S("a1cb"));
|
||||
test(s, s.end()-2, 'd', S("a1dcb"));
|
||||
test(s, s.end()-3, '2', S("a12dcb"));
|
||||
test(s, s.end()-4, '3', S("a132dcb"));
|
||||
test(s, s.end()-5, '4', S("a1432dcb"));
|
||||
test(s, s.begin()+1, '5', S("a51432dcb"));
|
||||
test(s, s.begin()+2, '6', S("a561432dcb"));
|
||||
test(s, s.begin()+3, '7', S("a5671432dcb"));
|
||||
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.end() - 1, 'c', S("a1cb"));
|
||||
test(s, s.end() - 2, 'd', S("a1dcb"));
|
||||
test(s, s.end() - 3, '2', S("a12dcb"));
|
||||
test(s, s.end() - 4, '3', S("a132dcb"));
|
||||
test(s, s.end() - 5, '4', S("a1432dcb"));
|
||||
test(s, s.begin() + 1, '5', S("a51432dcb"));
|
||||
test(s, s.begin() + 2, '6', S("a561432dcb"));
|
||||
test(s, s.begin() + 3, '7', S("a5671432dcb"));
|
||||
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_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -60,8 +58,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
// iterator insert(const_iterator p, initializer_list<charT> il); // constexpr since C++20
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@@ -37,8 +36,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,90 +18,82 @@
|
||||
#include "test_macros.h"
|
||||
|
||||
struct char_ascii {
|
||||
char char_;
|
||||
char char_;
|
||||
|
||||
char_ascii() = default;
|
||||
char_ascii(char ch) : char_(ch) {
|
||||
assert(ch <= 0x7f);
|
||||
}
|
||||
char_ascii() = default;
|
||||
char_ascii(char ch) : char_(ch) { assert(ch <= 0x7f); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct std::char_traits<char_ascii> {
|
||||
using char_type = char_ascii;
|
||||
using int_type = typename std::char_traits<char>::int_type;
|
||||
using off_type = typename std::char_traits<char>::off_type;
|
||||
using pos_type = typename std::char_traits<char>::pos_type;
|
||||
using state_type = typename std::char_traits<char>::state_type;
|
||||
using char_type = char_ascii;
|
||||
using int_type = typename std::char_traits<char>::int_type;
|
||||
using off_type = typename std::char_traits<char>::off_type;
|
||||
using pos_type = typename std::char_traits<char>::pos_type;
|
||||
using state_type = typename std::char_traits<char>::state_type;
|
||||
|
||||
static void assign(char_type& r, char_type const& a) TEST_NOEXCEPT {
|
||||
r = a;
|
||||
static void assign(char_type& r, char_type const& a) TEST_NOEXCEPT { r = a; }
|
||||
|
||||
static char_type* assign(char_type* p, std::size_t count, char_type a) {
|
||||
std::fill(p, p + count, a);
|
||||
return p;
|
||||
}
|
||||
|
||||
static bool eq(char_type a, char_type b) TEST_NOEXCEPT { return a.char_ == b.char_; }
|
||||
|
||||
static bool lt(char_type a, char_type b) TEST_NOEXCEPT { return a.char_ < b.char_; }
|
||||
|
||||
static std::size_t length(char_type const* s) {
|
||||
std::size_t n = 0;
|
||||
if (s) {
|
||||
while (s->char_)
|
||||
++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static char_type* assign(char_type* p, std::size_t count, char_type a) {
|
||||
std::fill(p, p + count, a);
|
||||
static const char_type* find(char_type const* p, std::size_t count, char_type const& ch) {
|
||||
while (count > 0) {
|
||||
if (p->char_ == ch.char_) {
|
||||
return p;
|
||||
} else {
|
||||
++p;
|
||||
--count;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool eq(char_type a, char_type b) TEST_NOEXCEPT {
|
||||
return a.char_ == b.char_;
|
||||
static int compare(char_type const* s1, char_type const* s2, std::size_t count) {
|
||||
for (std::size_t i = 0; i < count; ++i) {
|
||||
if (s1->char_ < s2->char_)
|
||||
return -1;
|
||||
else if (s2->char_ < s1->char_)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool lt(char_type a, char_type b) TEST_NOEXCEPT {
|
||||
return a.char_ < b.char_;
|
||||
static char_type* move(char_type* dest, char_type const* src, std::size_t count) {
|
||||
if (src <= dest && dest < src + count) {
|
||||
std::copy_backward(src, src + count, dest + count);
|
||||
} else {
|
||||
std::copy(src, src + count, dest);
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
static std::size_t length(char_type const* s) {
|
||||
std::size_t n = 0;
|
||||
if (s) {
|
||||
while (s->char_)
|
||||
++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static const char_type* find(char_type const* p, std::size_t count, char_type const& ch) {
|
||||
while (count > 0) {
|
||||
if (p->char_ == ch.char_) {
|
||||
return p;
|
||||
} else {
|
||||
++p;
|
||||
--count;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int compare(char_type const* s1, char_type const* s2, std::size_t count) {
|
||||
for (std::size_t i = 0; i < count; ++i) {
|
||||
if (s1->char_ < s2->char_)
|
||||
return -1;
|
||||
else if (s2->char_ < s1->char_)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char_type* move(char_type* dest, char_type const* src, std::size_t count) {
|
||||
if (src <= dest && dest < src + count) {
|
||||
std::copy_backward(src, src + count, dest + count);
|
||||
} else {
|
||||
std::copy(src, src + count, dest);
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
static char_type* copy(char_type* dest, char_type const* src, std::size_t count) {
|
||||
return char_traits::move(dest, src, count);
|
||||
}
|
||||
static char_type* copy(char_type* dest, char_type const* src, std::size_t count) {
|
||||
return char_traits::move(dest, src, count);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
std::basic_string<char_ascii> str;
|
||||
std::basic_string<char_ascii> str;
|
||||
|
||||
char_ascii ch('A');
|
||||
str.insert(str.begin(), &ch, &ch + 1);
|
||||
assert(str.size() == 1);
|
||||
assert(str[0].char_ == 'A');
|
||||
return 0;
|
||||
char_ascii ch('A');
|
||||
str.insert(str.begin(), &ch, &ch + 1);
|
||||
assert(str.size() == 1);
|
||||
assert(str[0].char_ == 'A');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,40 +19,39 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class It>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, It first, It last, S expected)
|
||||
{
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
typename S::iterator i = s.insert(p, first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(i - s.begin() == pos);
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, It first, It last, S expected) {
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
typename S::iterator i = s.insert(p, first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(i - s.begin() == pos);
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
struct Widget {
|
||||
operator char() const { throw 42; }
|
||||
};
|
||||
|
||||
template <class S, class It>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_exceptions(S s, typename S::difference_type pos, It first, It last)
|
||||
{
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
TEST_CONSTEXPR_CXX20 void test_exceptions(S s, typename S::difference_type pos, It first, It last) {
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
S original = s;
|
||||
typename S::iterator begin = s.begin();
|
||||
typename S::iterator end = s.end();
|
||||
|
||||
try {
|
||||
s.insert(p, first, last);
|
||||
assert(false);
|
||||
} catch (...) {}
|
||||
try {
|
||||
s.insert(p, first, last);
|
||||
assert(false);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
// Part of "no effects" is that iterators and pointers
|
||||
// into the string must not have been invalidated.
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == original);
|
||||
assert(s.begin() == begin);
|
||||
assert(s.end() == end);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,46 +59,88 @@ template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), 0, s, s, S());
|
||||
test(S(), 0, s, s+1, S("A"));
|
||||
test(S(), 0, s, s+10, S("ABCDEFGHIJ"));
|
||||
test(S(), 0, s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), 0, s, s + 1, S("A"));
|
||||
test(S(), 0, s, s + 10, S("ABCDEFGHIJ"));
|
||||
test(S(), 0, s, s + 52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), 0, s, s, S("12345"));
|
||||
test(S("12345"), 1, s, s+1, S("1A2345"));
|
||||
test(S("12345"), 4, s, s+10, S("1234ABCDEFGHIJ5"));
|
||||
test(S("12345"), 5, s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), 1, s, s + 1, S("1A2345"));
|
||||
test(S("12345"), 4, s, s + 10, S("1234ABCDEFGHIJ5"));
|
||||
test(S("12345"), 5, s, s + 52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), 0, s, s, S("1234567890"));
|
||||
test(S("1234567890"), 1, s, s+1, S("1A234567890"));
|
||||
test(S("1234567890"), 10, s, s+10, S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), 8, s, s+52, S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90"));
|
||||
test(S("1234567890"), 1, s, s + 1, S("1A234567890"));
|
||||
test(S("1234567890"), 10, s, s + 10, S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), 8, s, s + 52, S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90"));
|
||||
|
||||
test(S("12345678901234567890"), 3, s, s, S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), 3, s, s+1, S("123A45678901234567890"));
|
||||
test(S("12345678901234567890"), 15, s, s+10, S("123456789012345ABCDEFGHIJ67890"));
|
||||
test(S("12345678901234567890"), 20, s, s+52,
|
||||
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"), 3, s, s + 1, S("123A45678901234567890"));
|
||||
test(S("12345678901234567890"), 15, s, s + 10, S("123456789012345ABCDEFGHIJ67890"));
|
||||
test(S("12345678901234567890"),
|
||||
20,
|
||||
s,
|
||||
s + 52,
|
||||
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S());
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("A"));
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10), S("ABCDEFGHIJ"));
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("A"));
|
||||
test(S(), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 10), S("ABCDEFGHIJ"));
|
||||
test(S(),
|
||||
0,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("12345"), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S("12345"));
|
||||
test(S("12345"), 1, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("1A2345"));
|
||||
test(S("12345"), 4, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10), S("1234ABCDEFGHIJ5"));
|
||||
test(S("12345"), 5, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52), S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345"), 1, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s + 1), S("1A2345"));
|
||||
test(S("12345"),
|
||||
4,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("1234ABCDEFGHIJ5"));
|
||||
test(S("12345"),
|
||||
5,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
|
||||
test(S("1234567890"), 0, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S("1234567890"));
|
||||
test(S("1234567890"), 1, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("1A234567890"));
|
||||
test(S("1234567890"), 10, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10), S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"), 8, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52), S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90"));
|
||||
test(S("1234567890"),
|
||||
1,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 1),
|
||||
S("1A234567890"));
|
||||
test(S("1234567890"),
|
||||
10,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("1234567890ABCDEFGHIJ"));
|
||||
test(S("1234567890"),
|
||||
8,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90"));
|
||||
|
||||
test(S("12345678901234567890"), 3, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s), S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), 3, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+1), S("123A45678901234567890"));
|
||||
test(S("12345678901234567890"), 15, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+10), S("123456789012345ABCDEFGHIJ67890"));
|
||||
test(S("12345678901234567890"), 20, cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
test(S("12345678901234567890"),
|
||||
3,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
S("12345678901234567890"));
|
||||
test(S("12345678901234567890"),
|
||||
3,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 1),
|
||||
S("123A45678901234567890"));
|
||||
test(S("12345678901234567890"),
|
||||
15,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 10),
|
||||
S("123456789012345ABCDEFGHIJ67890"));
|
||||
test(S("12345678901234567890"),
|
||||
20,
|
||||
cpp17_input_iterator<const char*>(s),
|
||||
cpp17_input_iterator<const char*>(s + 52),
|
||||
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -114,16 +155,16 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s + 10, 4, TIter::TAIncrement)), IIter(TIter()));
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s + 10, 5, TIter::TADereference)), IIter(TIter()));
|
||||
test_exceptions(S(), 0, IIter(TIter(s, s + 10, 6, TIter::TAComparison)), IIter(TIter()));
|
||||
|
||||
test_exceptions(S(), 0, TIter(s, s+10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), 0, TIter(s, s+10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), 0, TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
test_exceptions(S(), 0, TIter(s, s + 10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), 0, TIter(s, s + 10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), 0, TIter(s, s + 10, 6, TIter::TAComparison), TIter());
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), 0, w, w+100);
|
||||
test_exceptions(S(), 0, w, w + 100);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -153,14 +194,16 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
}
|
||||
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) { // regression-test inserting into self in sneaky ways
|
||||
std::string s_short = "hello";
|
||||
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
std::string s_othertype = "hello";
|
||||
const unsigned char *first = reinterpret_cast<const unsigned char*>(s_othertype.data());
|
||||
std::string s_short = "hello";
|
||||
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
std::string s_othertype = "hello";
|
||||
const unsigned char* first = reinterpret_cast<const unsigned char*>(s_othertype.data());
|
||||
|
||||
test(s_short, 0, s_short.data() + s_short.size(), s_short.data() + s_short.size() + 1,
|
||||
std::string("\0hello", 6));
|
||||
test(s_long, 0, s_long.data() + s_long.size(), s_long.data() + s_long.size() + 1,
|
||||
test(s_short, 0, s_short.data() + s_short.size(), s_short.data() + s_short.size() + 1, std::string("\0hello", 6));
|
||||
test(s_long,
|
||||
0,
|
||||
s_long.data() + s_long.size(),
|
||||
s_long.data() + s_long.size() + 1,
|
||||
std::string("\0Lorem ipsum dolor sit amet, consectetur/", 41));
|
||||
test(s_othertype, 1, first + 2, first + 5, std::string("hlloello"));
|
||||
}
|
||||
@@ -192,8 +235,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,14 +18,12 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, typename S::size_type n,
|
||||
typename S::value_type c, S expected)
|
||||
{
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
typename S::iterator i = s.insert(p, n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(i - s.begin() == pos);
|
||||
assert(s == expected);
|
||||
test(S s, typename S::difference_type pos, typename S::size_type n, typename S::value_type c, S expected) {
|
||||
typename S::const_iterator p = s.cbegin() + pos;
|
||||
typename S::iterator i = s.insert(p, n, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(i - s.begin() == pos);
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -105,8 +103,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,31 +19,24 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, const typename S::value_type* str, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.insert(pos, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, const typename S::value_type* str, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.insert(pos, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.insert(pos, str);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.insert(pos, str);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -156,8 +149,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -20,31 +20,24 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, const typename S::value_type* str,
|
||||
typename S::size_type n, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.insert(pos, str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
test(S s, typename S::size_type pos, const typename S::value_type* str, typename S::size_type n, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.insert(pos, str, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.insert(pos, str, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.insert(pos, str, n);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -391,8 +384,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
@@ -20,31 +20,24 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n,
|
||||
typename S::value_type str, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.insert(pos, n, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
test(S s, typename S::size_type pos, typename S::size_type n, typename S::value_type str, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.insert(pos, n, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.insert(pos, n, str);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.insert(pos, n, str);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -141,8 +134,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,31 +19,24 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, S str, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.insert(pos, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, S str, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.insert(pos, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.insert(pos, str);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.insert(pos, str);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -138,7 +131,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s.insert(0, {"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
@@ -149,8 +142,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,31 +19,24 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, SV sv, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.insert(pos, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, SV sv, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.insert(pos, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.insert(pos, sv);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.insert(pos, sv);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -157,8 +150,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::value_type str, S expected)
|
||||
{
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type str, S expected) {
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -46,8 +44,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -34,8 +34,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, S expected)
|
||||
{
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expected) {
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -45,8 +43,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), "", S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -58,8 +55,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) {
|
||||
s += str;
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -46,8 +44,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
|
||||
test(S("12345678901234567890"), S(), S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -68,8 +65,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -34,8 +34,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,269 +22,265 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, S expected)
|
||||
{
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = S::traits_type::length(str);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, S expected) {
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = S::traits_type::length(str);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
test(S(""), 0, 0, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 0, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, "", S("abcde"));
|
||||
test(S("abcde"), 0, 0, "12345", S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, "1234567890", S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, "12345678901234567890", S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, "", S("bcde"));
|
||||
test(S("abcde"), 0, 1, "12345", S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, "1234567890", S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, "12345678901234567890", S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, "", S("cde"));
|
||||
test(S("abcde"), 0, 2, "12345", S("12345cde"));
|
||||
test(S("abcde"), 0, 2, "1234567890", S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, "12345678901234567890", S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, "", S("e"));
|
||||
test(S("abcde"), 0, 4, "12345", S("12345e"));
|
||||
test(S("abcde"), 0, 4, "1234567890", S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, "12345678901234567890", S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, "", S(""));
|
||||
test(S("abcde"), 0, 5, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 5, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 5, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, "", S("abcde"));
|
||||
test(S("abcde"), 1, 0, "12345", S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, "1234567890", S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, "12345678901234567890", S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, "", S("acde"));
|
||||
test(S("abcde"), 1, 1, "12345", S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, "1234567890", S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, "12345678901234567890", S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, "", S("ade"));
|
||||
test(S("abcde"), 1, 2, "12345", S("a12345de"));
|
||||
test(S("abcde"), 1, 2, "1234567890", S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, "12345678901234567890", S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, "", S("ae"));
|
||||
test(S("abcde"), 1, 3, "12345", S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, "12345678901234567890", S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, "", S("a"));
|
||||
test(S("abcde"), 1, 4, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 4, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, "", S("abcde"));
|
||||
test(S("abcde"), 2, 0, "12345", S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, "1234567890", S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, "12345678901234567890", S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, "", S("abde"));
|
||||
test(S("abcde"), 2, 1, "12345", S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, "12345678901234567890", S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, "", S("abe"));
|
||||
test(S("abcde"), 2, 2, "12345", S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, "1234567890", S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, "12345678901234567890", S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, "", S("ab"));
|
||||
test(S("abcde"), 2, 3, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 3, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, "", S("abcde"));
|
||||
test(S("abcde"), 4, 0, "12345", S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, "1234567890", S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, "12345678901234567890", S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, "", S("abcd"));
|
||||
test(S("abcde"), 4, 1, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, "", S("abcde"));
|
||||
test(S("abcde"), 5, 0, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345", S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "", S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345", S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "1234567890", S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, "", S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345", S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "1234567890", S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345678901234567890", S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, "", S("j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345", S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, "1234567890", S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345678901234567890", S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, "", S(""));
|
||||
test(S("abcdefghij"), 0, 10, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345", S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "1234567890", S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "", S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345", S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "1234567890", S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
test(S(""), 0, 0, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 0, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, "", S("abcde"));
|
||||
test(S("abcde"), 0, 0, "12345", S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, "1234567890", S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, "12345678901234567890", S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, "", S("bcde"));
|
||||
test(S("abcde"), 0, 1, "12345", S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, "1234567890", S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, "12345678901234567890", S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, "", S("cde"));
|
||||
test(S("abcde"), 0, 2, "12345", S("12345cde"));
|
||||
test(S("abcde"), 0, 2, "1234567890", S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, "12345678901234567890", S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, "", S("e"));
|
||||
test(S("abcde"), 0, 4, "12345", S("12345e"));
|
||||
test(S("abcde"), 0, 4, "1234567890", S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, "12345678901234567890", S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, "", S(""));
|
||||
test(S("abcde"), 0, 5, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 5, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 5, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, "", S("abcde"));
|
||||
test(S("abcde"), 1, 0, "12345", S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, "1234567890", S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, "12345678901234567890", S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, "", S("acde"));
|
||||
test(S("abcde"), 1, 1, "12345", S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, "1234567890", S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, "12345678901234567890", S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, "", S("ade"));
|
||||
test(S("abcde"), 1, 2, "12345", S("a12345de"));
|
||||
test(S("abcde"), 1, 2, "1234567890", S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, "12345678901234567890", S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, "", S("ae"));
|
||||
test(S("abcde"), 1, 3, "12345", S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, "12345678901234567890", S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, "", S("a"));
|
||||
test(S("abcde"), 1, 4, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 4, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, "", S("abcde"));
|
||||
test(S("abcde"), 2, 0, "12345", S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, "1234567890", S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, "12345678901234567890", S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, "", S("abde"));
|
||||
test(S("abcde"), 2, 1, "12345", S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, "12345678901234567890", S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, "", S("abe"));
|
||||
test(S("abcde"), 2, 2, "12345", S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, "1234567890", S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, "12345678901234567890", S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, "", S("ab"));
|
||||
test(S("abcde"), 2, 3, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 3, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, "", S("abcde"));
|
||||
test(S("abcde"), 4, 0, "12345", S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, "1234567890", S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, "12345678901234567890", S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, "", S("abcd"));
|
||||
test(S("abcde"), 4, 1, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, "", S("abcde"));
|
||||
test(S("abcde"), 5, 0, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345", S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "", S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345", S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "1234567890", S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, "", S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345", S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "1234567890", S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345678901234567890", S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, "", S("j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345", S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, "1234567890", S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345678901234567890", S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, "", S(""));
|
||||
test(S("abcdefghij"), 0, 10, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345", S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "1234567890", S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "", S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345", S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "1234567890", S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, "", S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "1234567890", S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345678901234567890", S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, "", S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, "12345", S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, "1234567890", S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, "12345678901234567890", S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 9, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345", S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "1234567890", S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345678901234567890", S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, "", S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345", S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "1234567890", S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345678901234567890", S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, "", S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345", S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, "1234567890", S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345678901234567890", S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, "", S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, "1234567890", S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345678901234567890", S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, "12345", S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, "1234567890", S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, "12345678901234567890", S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "", S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345", S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "", S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345", S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "", S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345", S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "", S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345", S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "", S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345", S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "", S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345", S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345", S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "", S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345", S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "", S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345", S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "", S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345", S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcdefghij"), 1, 4, "", S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "1234567890", S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345678901234567890", S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, "", S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, "12345", S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, "1234567890", S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, "12345678901234567890", S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 9, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345", S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "1234567890", S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345678901234567890", S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, "", S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345", S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "1234567890", S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345678901234567890", S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, "", S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345", S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, "1234567890", S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345678901234567890", S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, "", S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, "1234567890", S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345678901234567890", S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, "12345", S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, "1234567890", S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, "12345678901234567890", S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "", S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345", S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "", S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345", S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "", S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345", S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "", S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345", S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "", S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345", S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "", S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345", S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345", S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "", S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345", S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "", S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345", S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "", S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345", S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345", S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345", S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
{ // test replacing into self
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
{ // test replacing into self
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 void test() {
|
||||
@@ -305,17 +301,16 @@ TEST_CONSTEXPR_CXX20 void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
#if TEST_STD_VER > 17
|
||||
# if TEST_STD_VER > 17
|
||||
static_assert(test0<S>());
|
||||
static_assert(test1<S>());
|
||||
static_assert(test2<S>());
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
return 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,249 +20,249 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size_type n2,
|
||||
typename S::value_type c, S expected)
|
||||
{
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, n2, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
test(S s,
|
||||
typename S::size_type pos1,
|
||||
typename S::size_type n1,
|
||||
typename S::size_type n2,
|
||||
typename S::value_type c,
|
||||
S expected) {
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, n2, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, 0, '3', S(""));
|
||||
test(S(""), 0, 0, 5, '3', S("33333"));
|
||||
test(S(""), 0, 0, 10, '3', S("3333333333"));
|
||||
test(S(""), 0, 0, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcde"), 0, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 0, 0, 5, '3', S("33333abcde"));
|
||||
test(S("abcde"), 0, 0, 10, '3', S("3333333333abcde"));
|
||||
test(S("abcde"), 0, 0, 20, '3', S("33333333333333333333abcde"));
|
||||
test(S("abcde"), 0, 1, 0, '3', S("bcde"));
|
||||
test(S("abcde"), 0, 1, 5, '3', S("33333bcde"));
|
||||
test(S("abcde"), 0, 1, 10, '3', S("3333333333bcde"));
|
||||
test(S("abcde"), 0, 1, 20, '3', S("33333333333333333333bcde"));
|
||||
test(S("abcde"), 0, 2, 0, '3', S("cde"));
|
||||
test(S("abcde"), 0, 2, 5, '3', S("33333cde"));
|
||||
test(S("abcde"), 0, 2, 10, '3', S("3333333333cde"));
|
||||
test(S("abcde"), 0, 2, 20, '3', S("33333333333333333333cde"));
|
||||
test(S("abcde"), 0, 4, 0, '3', S("e"));
|
||||
test(S("abcde"), 0, 4, 5, '3', S("33333e"));
|
||||
test(S("abcde"), 0, 4, 10, '3', S("3333333333e"));
|
||||
test(S("abcde"), 0, 4, 20, '3', S("33333333333333333333e"));
|
||||
test(S("abcde"), 0, 5, 0, '3', S(""));
|
||||
test(S("abcde"), 0, 5, 5, '3', S("33333"));
|
||||
test(S("abcde"), 0, 5, 10, '3', S("3333333333"));
|
||||
test(S("abcde"), 0, 5, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcde"), 1, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 1, 0, 5, '3', S("a33333bcde"));
|
||||
test(S("abcde"), 1, 0, 10, '3', S("a3333333333bcde"));
|
||||
test(S("abcde"), 1, 0, 20, '3', S("a33333333333333333333bcde"));
|
||||
test(S("abcde"), 1, 1, 0, '3', S("acde"));
|
||||
test(S("abcde"), 1, 1, 5, '3', S("a33333cde"));
|
||||
test(S("abcde"), 1, 1, 10, '3', S("a3333333333cde"));
|
||||
test(S("abcde"), 1, 1, 20, '3', S("a33333333333333333333cde"));
|
||||
test(S("abcde"), 1, 2, 0, '3', S("ade"));
|
||||
test(S("abcde"), 1, 2, 5, '3', S("a33333de"));
|
||||
test(S("abcde"), 1, 2, 10, '3', S("a3333333333de"));
|
||||
test(S("abcde"), 1, 2, 20, '3', S("a33333333333333333333de"));
|
||||
test(S("abcde"), 1, 3, 0, '3', S("ae"));
|
||||
test(S("abcde"), 1, 3, 5, '3', S("a33333e"));
|
||||
test(S("abcde"), 1, 3, 10, '3', S("a3333333333e"));
|
||||
test(S("abcde"), 1, 3, 20, '3', S("a33333333333333333333e"));
|
||||
test(S("abcde"), 1, 4, 0, '3', S("a"));
|
||||
test(S("abcde"), 1, 4, 5, '3', S("a33333"));
|
||||
test(S("abcde"), 1, 4, 10, '3', S("a3333333333"));
|
||||
test(S("abcde"), 1, 4, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcde"), 2, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 2, 0, 5, '3', S("ab33333cde"));
|
||||
test(S("abcde"), 2, 0, 10, '3', S("ab3333333333cde"));
|
||||
test(S("abcde"), 2, 0, 20, '3', S("ab33333333333333333333cde"));
|
||||
test(S("abcde"), 2, 1, 0, '3', S("abde"));
|
||||
test(S("abcde"), 2, 1, 5, '3', S("ab33333de"));
|
||||
test(S("abcde"), 2, 1, 10, '3', S("ab3333333333de"));
|
||||
test(S("abcde"), 2, 1, 20, '3', S("ab33333333333333333333de"));
|
||||
test(S("abcde"), 2, 2, 0, '3', S("abe"));
|
||||
test(S("abcde"), 2, 2, 5, '3', S("ab33333e"));
|
||||
test(S("abcde"), 2, 2, 10, '3', S("ab3333333333e"));
|
||||
test(S("abcde"), 2, 2, 20, '3', S("ab33333333333333333333e"));
|
||||
test(S("abcde"), 2, 3, 0, '3', S("ab"));
|
||||
test(S("abcde"), 2, 3, 5, '3', S("ab33333"));
|
||||
test(S("abcde"), 2, 3, 10, '3', S("ab3333333333"));
|
||||
test(S("abcde"), 2, 3, 20, '3', S("ab33333333333333333333"));
|
||||
test(S("abcde"), 4, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 4, 0, 5, '3', S("abcd33333e"));
|
||||
test(S("abcde"), 4, 0, 10, '3', S("abcd3333333333e"));
|
||||
test(S("abcde"), 4, 0, 20, '3', S("abcd33333333333333333333e"));
|
||||
test(S("abcde"), 4, 1, 0, '3', S("abcd"));
|
||||
test(S("abcde"), 4, 1, 5, '3', S("abcd33333"));
|
||||
test(S("abcde"), 4, 1, 10, '3', S("abcd3333333333"));
|
||||
test(S("abcde"), 4, 1, 20, '3', S("abcd33333333333333333333"));
|
||||
test(S("abcde"), 5, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 5, 0, 5, '3', S("abcde33333"));
|
||||
test(S("abcde"), 5, 0, 10, '3', S("abcde3333333333"));
|
||||
test(S("abcde"), 5, 0, 20, '3', S("abcde33333333333333333333"));
|
||||
test(S("abcdefghij"), 0, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 5, '3', S("33333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 10, '3', S("3333333333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 20, '3', S("33333333333333333333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 0, '3', S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 5, '3', S("33333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 10, '3', S("3333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 20, '3', S("33333333333333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, 0, '3', S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 5, '3', S("33333fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 10, '3', S("3333333333fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 20, '3', S("33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 0, 9, 0, '3', S("j"));
|
||||
test(S("abcdefghij"), 0, 9, 5, '3', S("33333j"));
|
||||
test(S("abcdefghij"), 0, 9, 10, '3', S("3333333333j"));
|
||||
test(S("abcdefghij"), 0, 9, 20, '3', S("33333333333333333333j"));
|
||||
test(S("abcdefghij"), 0, 10, 0, '3', S(""));
|
||||
test(S("abcdefghij"), 0, 10, 5, '3', S("33333"));
|
||||
test(S("abcdefghij"), 0, 10, 10, '3', S("3333333333"));
|
||||
test(S("abcdefghij"), 0, 10, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcdefghij"), 1, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 5, '3', S("a33333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 10, '3', S("a3333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 20, '3', S("a33333333333333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 0, '3', S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 5, '3', S("a33333cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 10, '3', S("a3333333333cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 20, '3', S("a33333333333333333333cdefghij"));
|
||||
TEST_CONSTEXPR_CXX20 void test0() {
|
||||
test(S(""), 0, 0, 0, '3', S(""));
|
||||
test(S(""), 0, 0, 5, '3', S("33333"));
|
||||
test(S(""), 0, 0, 10, '3', S("3333333333"));
|
||||
test(S(""), 0, 0, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcde"), 0, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 0, 0, 5, '3', S("33333abcde"));
|
||||
test(S("abcde"), 0, 0, 10, '3', S("3333333333abcde"));
|
||||
test(S("abcde"), 0, 0, 20, '3', S("33333333333333333333abcde"));
|
||||
test(S("abcde"), 0, 1, 0, '3', S("bcde"));
|
||||
test(S("abcde"), 0, 1, 5, '3', S("33333bcde"));
|
||||
test(S("abcde"), 0, 1, 10, '3', S("3333333333bcde"));
|
||||
test(S("abcde"), 0, 1, 20, '3', S("33333333333333333333bcde"));
|
||||
test(S("abcde"), 0, 2, 0, '3', S("cde"));
|
||||
test(S("abcde"), 0, 2, 5, '3', S("33333cde"));
|
||||
test(S("abcde"), 0, 2, 10, '3', S("3333333333cde"));
|
||||
test(S("abcde"), 0, 2, 20, '3', S("33333333333333333333cde"));
|
||||
test(S("abcde"), 0, 4, 0, '3', S("e"));
|
||||
test(S("abcde"), 0, 4, 5, '3', S("33333e"));
|
||||
test(S("abcde"), 0, 4, 10, '3', S("3333333333e"));
|
||||
test(S("abcde"), 0, 4, 20, '3', S("33333333333333333333e"));
|
||||
test(S("abcde"), 0, 5, 0, '3', S(""));
|
||||
test(S("abcde"), 0, 5, 5, '3', S("33333"));
|
||||
test(S("abcde"), 0, 5, 10, '3', S("3333333333"));
|
||||
test(S("abcde"), 0, 5, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcde"), 1, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 1, 0, 5, '3', S("a33333bcde"));
|
||||
test(S("abcde"), 1, 0, 10, '3', S("a3333333333bcde"));
|
||||
test(S("abcde"), 1, 0, 20, '3', S("a33333333333333333333bcde"));
|
||||
test(S("abcde"), 1, 1, 0, '3', S("acde"));
|
||||
test(S("abcde"), 1, 1, 5, '3', S("a33333cde"));
|
||||
test(S("abcde"), 1, 1, 10, '3', S("a3333333333cde"));
|
||||
test(S("abcde"), 1, 1, 20, '3', S("a33333333333333333333cde"));
|
||||
test(S("abcde"), 1, 2, 0, '3', S("ade"));
|
||||
test(S("abcde"), 1, 2, 5, '3', S("a33333de"));
|
||||
test(S("abcde"), 1, 2, 10, '3', S("a3333333333de"));
|
||||
test(S("abcde"), 1, 2, 20, '3', S("a33333333333333333333de"));
|
||||
test(S("abcde"), 1, 3, 0, '3', S("ae"));
|
||||
test(S("abcde"), 1, 3, 5, '3', S("a33333e"));
|
||||
test(S("abcde"), 1, 3, 10, '3', S("a3333333333e"));
|
||||
test(S("abcde"), 1, 3, 20, '3', S("a33333333333333333333e"));
|
||||
test(S("abcde"), 1, 4, 0, '3', S("a"));
|
||||
test(S("abcde"), 1, 4, 5, '3', S("a33333"));
|
||||
test(S("abcde"), 1, 4, 10, '3', S("a3333333333"));
|
||||
test(S("abcde"), 1, 4, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcde"), 2, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 2, 0, 5, '3', S("ab33333cde"));
|
||||
test(S("abcde"), 2, 0, 10, '3', S("ab3333333333cde"));
|
||||
test(S("abcde"), 2, 0, 20, '3', S("ab33333333333333333333cde"));
|
||||
test(S("abcde"), 2, 1, 0, '3', S("abde"));
|
||||
test(S("abcde"), 2, 1, 5, '3', S("ab33333de"));
|
||||
test(S("abcde"), 2, 1, 10, '3', S("ab3333333333de"));
|
||||
test(S("abcde"), 2, 1, 20, '3', S("ab33333333333333333333de"));
|
||||
test(S("abcde"), 2, 2, 0, '3', S("abe"));
|
||||
test(S("abcde"), 2, 2, 5, '3', S("ab33333e"));
|
||||
test(S("abcde"), 2, 2, 10, '3', S("ab3333333333e"));
|
||||
test(S("abcde"), 2, 2, 20, '3', S("ab33333333333333333333e"));
|
||||
test(S("abcde"), 2, 3, 0, '3', S("ab"));
|
||||
test(S("abcde"), 2, 3, 5, '3', S("ab33333"));
|
||||
test(S("abcde"), 2, 3, 10, '3', S("ab3333333333"));
|
||||
test(S("abcde"), 2, 3, 20, '3', S("ab33333333333333333333"));
|
||||
test(S("abcde"), 4, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 4, 0, 5, '3', S("abcd33333e"));
|
||||
test(S("abcde"), 4, 0, 10, '3', S("abcd3333333333e"));
|
||||
test(S("abcde"), 4, 0, 20, '3', S("abcd33333333333333333333e"));
|
||||
test(S("abcde"), 4, 1, 0, '3', S("abcd"));
|
||||
test(S("abcde"), 4, 1, 5, '3', S("abcd33333"));
|
||||
test(S("abcde"), 4, 1, 10, '3', S("abcd3333333333"));
|
||||
test(S("abcde"), 4, 1, 20, '3', S("abcd33333333333333333333"));
|
||||
test(S("abcde"), 5, 0, 0, '3', S("abcde"));
|
||||
test(S("abcde"), 5, 0, 5, '3', S("abcde33333"));
|
||||
test(S("abcde"), 5, 0, 10, '3', S("abcde3333333333"));
|
||||
test(S("abcde"), 5, 0, 20, '3', S("abcde33333333333333333333"));
|
||||
test(S("abcdefghij"), 0, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 5, '3', S("33333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 10, '3', S("3333333333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 20, '3', S("33333333333333333333abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 0, '3', S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 5, '3', S("33333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 10, '3', S("3333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 20, '3', S("33333333333333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, 0, '3', S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 5, '3', S("33333fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 10, '3', S("3333333333fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 20, '3', S("33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 0, 9, 0, '3', S("j"));
|
||||
test(S("abcdefghij"), 0, 9, 5, '3', S("33333j"));
|
||||
test(S("abcdefghij"), 0, 9, 10, '3', S("3333333333j"));
|
||||
test(S("abcdefghij"), 0, 9, 20, '3', S("33333333333333333333j"));
|
||||
test(S("abcdefghij"), 0, 10, 0, '3', S(""));
|
||||
test(S("abcdefghij"), 0, 10, 5, '3', S("33333"));
|
||||
test(S("abcdefghij"), 0, 10, 10, '3', S("3333333333"));
|
||||
test(S("abcdefghij"), 0, 10, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcdefghij"), 1, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 5, '3', S("a33333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 10, '3', S("a3333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 20, '3', S("a33333333333333333333bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 0, '3', S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 5, '3', S("a33333cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 10, '3', S("a3333333333cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 20, '3', S("a33333333333333333333cdefghij"));
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, 0, '3', S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, 5, '3', S("a33333fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 10, '3', S("a3333333333fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 20, '3', S("a33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 1, 8, 0, '3', S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, 5, '3', S("a33333j"));
|
||||
test(S("abcdefghij"), 1, 8, 10, '3', S("a3333333333j"));
|
||||
test(S("abcdefghij"), 1, 8, 20, '3', S("a33333333333333333333j"));
|
||||
test(S("abcdefghij"), 1, 9, 0, '3', S("a"));
|
||||
test(S("abcdefghij"), 1, 9, 5, '3', S("a33333"));
|
||||
test(S("abcdefghij"), 1, 9, 10, '3', S("a3333333333"));
|
||||
test(S("abcdefghij"), 1, 9, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcdefghij"), 5, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, 5, '3', S("abcde33333fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 10, '3', S("abcde3333333333fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 20, '3', S("abcde33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 5, 1, 0, '3', S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, 5, '3', S("abcde33333ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 10, '3', S("abcde3333333333ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 20, '3', S("abcde33333333333333333333ghij"));
|
||||
test(S("abcdefghij"), 5, 2, 0, '3', S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, 5, '3', S("abcde33333hij"));
|
||||
test(S("abcdefghij"), 5, 2, 10, '3', S("abcde3333333333hij"));
|
||||
test(S("abcdefghij"), 5, 2, 20, '3', S("abcde33333333333333333333hij"));
|
||||
test(S("abcdefghij"), 5, 4, 0, '3', S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, 5, '3', S("abcde33333j"));
|
||||
test(S("abcdefghij"), 5, 4, 10, '3', S("abcde3333333333j"));
|
||||
test(S("abcdefghij"), 5, 4, 20, '3', S("abcde33333333333333333333j"));
|
||||
test(S("abcdefghij"), 5, 5, 0, '3', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, 5, '3', S("abcde33333"));
|
||||
test(S("abcdefghij"), 5, 5, 10, '3', S("abcde3333333333"));
|
||||
test(S("abcdefghij"), 5, 5, 20, '3', S("abcde33333333333333333333"));
|
||||
test(S("abcdefghij"), 9, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, 5, '3', S("abcdefghi33333j"));
|
||||
test(S("abcdefghij"), 9, 0, 10, '3', S("abcdefghi3333333333j"));
|
||||
test(S("abcdefghij"), 9, 0, 20, '3', S("abcdefghi33333333333333333333j"));
|
||||
test(S("abcdefghij"), 9, 1, 0, '3', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, 5, '3', S("abcdefghi33333"));
|
||||
test(S("abcdefghij"), 9, 1, 10, '3', S("abcdefghi3333333333"));
|
||||
test(S("abcdefghij"), 9, 1, 20, '3', S("abcdefghi33333333333333333333"));
|
||||
test(S("abcdefghij"), 10, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, 5, '3', S("abcdefghij33333"));
|
||||
test(S("abcdefghij"), 10, 0, 10, '3', S("abcdefghij3333333333"));
|
||||
test(S("abcdefghij"), 10, 0, 20, '3', S("abcdefghij33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '3', S("33333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 10, '3', S("3333333333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 20, '3', S("33333333333333333333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 0, '3', S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 5, '3', S("33333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 10, '3', S("3333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 20, '3', S("33333333333333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 0, '3', S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 5, '3', S("33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 10, '3', S("3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 20, '3', S("33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 0, '3', S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 5, '3', S("33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 10, '3', S("3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 20, '3', S("33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 0, '3', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 5, '3', S("33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 10, '3', S("3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 5, '3', S("a33333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 10, '3', S("a3333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 20, '3', S("a33333333333333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 0, '3', S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 5, '3', S("a33333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 10, '3', S("a3333333333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 20, '3', S("a33333333333333333333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 0, '3', S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 5, '3', S("a33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 10, '3', S("a3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 20, '3', S("a33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 0, '3', S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 5, '3', S("a33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 10, '3', S("a3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 20, '3', S("a33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 0, '3', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 5, '3', S("a33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 10, '3', S("a3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 5, '3', S("abcdefghij33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 10, '3', S("abcdefghij3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 20, '3', S("abcdefghij33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 0, '3', S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 5, '3', S("abcdefghij33333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 10, '3', S("abcdefghij3333333333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 20, '3', S("abcdefghij33333333333333333333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 0, '3', S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 5, '3', S("abcdefghij33333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 10, '3', S("abcdefghij3333333333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 20, '3', S("abcdefghij33333333333333333333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 0, '3', S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 5, '3', S("abcdefghij33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 10, '3', S("abcdefghij3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 20, '3', S("abcdefghij33333333333333333333t"));
|
||||
TEST_CONSTEXPR_CXX20 void test1() {
|
||||
test(S("abcdefghij"), 1, 4, 0, '3', S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, 5, '3', S("a33333fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 10, '3', S("a3333333333fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 20, '3', S("a33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 1, 8, 0, '3', S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, 5, '3', S("a33333j"));
|
||||
test(S("abcdefghij"), 1, 8, 10, '3', S("a3333333333j"));
|
||||
test(S("abcdefghij"), 1, 8, 20, '3', S("a33333333333333333333j"));
|
||||
test(S("abcdefghij"), 1, 9, 0, '3', S("a"));
|
||||
test(S("abcdefghij"), 1, 9, 5, '3', S("a33333"));
|
||||
test(S("abcdefghij"), 1, 9, 10, '3', S("a3333333333"));
|
||||
test(S("abcdefghij"), 1, 9, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcdefghij"), 5, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, 5, '3', S("abcde33333fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 10, '3', S("abcde3333333333fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 20, '3', S("abcde33333333333333333333fghij"));
|
||||
test(S("abcdefghij"), 5, 1, 0, '3', S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, 5, '3', S("abcde33333ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 10, '3', S("abcde3333333333ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 20, '3', S("abcde33333333333333333333ghij"));
|
||||
test(S("abcdefghij"), 5, 2, 0, '3', S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, 5, '3', S("abcde33333hij"));
|
||||
test(S("abcdefghij"), 5, 2, 10, '3', S("abcde3333333333hij"));
|
||||
test(S("abcdefghij"), 5, 2, 20, '3', S("abcde33333333333333333333hij"));
|
||||
test(S("abcdefghij"), 5, 4, 0, '3', S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, 5, '3', S("abcde33333j"));
|
||||
test(S("abcdefghij"), 5, 4, 10, '3', S("abcde3333333333j"));
|
||||
test(S("abcdefghij"), 5, 4, 20, '3', S("abcde33333333333333333333j"));
|
||||
test(S("abcdefghij"), 5, 5, 0, '3', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, 5, '3', S("abcde33333"));
|
||||
test(S("abcdefghij"), 5, 5, 10, '3', S("abcde3333333333"));
|
||||
test(S("abcdefghij"), 5, 5, 20, '3', S("abcde33333333333333333333"));
|
||||
test(S("abcdefghij"), 9, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, 5, '3', S("abcdefghi33333j"));
|
||||
test(S("abcdefghij"), 9, 0, 10, '3', S("abcdefghi3333333333j"));
|
||||
test(S("abcdefghij"), 9, 0, 20, '3', S("abcdefghi33333333333333333333j"));
|
||||
test(S("abcdefghij"), 9, 1, 0, '3', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, 5, '3', S("abcdefghi33333"));
|
||||
test(S("abcdefghij"), 9, 1, 10, '3', S("abcdefghi3333333333"));
|
||||
test(S("abcdefghij"), 9, 1, 20, '3', S("abcdefghi33333333333333333333"));
|
||||
test(S("abcdefghij"), 10, 0, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, 5, '3', S("abcdefghij33333"));
|
||||
test(S("abcdefghij"), 10, 0, 10, '3', S("abcdefghij3333333333"));
|
||||
test(S("abcdefghij"), 10, 0, 20, '3', S("abcdefghij33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '3', S("33333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 10, '3', S("3333333333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 20, '3', S("33333333333333333333abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 0, '3', S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 5, '3', S("33333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 10, '3', S("3333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 20, '3', S("33333333333333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 0, '3', S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 5, '3', S("33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 10, '3', S("3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 20, '3', S("33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 0, '3', S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 5, '3', S("33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 10, '3', S("3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 20, '3', S("33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 0, '3', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 5, '3', S("33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 10, '3', S("3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 20, '3', S("33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 5, '3', S("a33333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 10, '3', S("a3333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 20, '3', S("a33333333333333333333bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 0, '3', S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 5, '3', S("a33333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 10, '3', S("a3333333333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 20, '3', S("a33333333333333333333cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 0, '3', S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 5, '3', S("a33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 10, '3', S("a3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 20, '3', S("a33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 0, '3', S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 5, '3', S("a33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 10, '3', S("a3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 20, '3', S("a33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 0, '3', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 5, '3', S("a33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 10, '3', S("a3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 20, '3', S("a33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 5, '3', S("abcdefghij33333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 10, '3', S("abcdefghij3333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 20, '3', S("abcdefghij33333333333333333333klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 0, '3', S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 5, '3', S("abcdefghij33333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 10, '3', S("abcdefghij3333333333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 20, '3', S("abcdefghij33333333333333333333lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 0, '3', S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 5, '3', S("abcdefghij33333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 10, '3', S("abcdefghij3333333333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 20, '3', S("abcdefghij33333333333333333333pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 0, '3', S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 5, '3', S("abcdefghij33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 10, '3', S("abcdefghij3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 20, '3', S("abcdefghij33333333333333333333t"));
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 5, '3', S("abcdefghij33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 10, '3', S("abcdefghij3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 20, '3', S("abcdefghij33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 5, '3', S("abcdefghijklmnopqrs33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 10, '3', S("abcdefghijklmnopqrs3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 20, '3', S("abcdefghijklmnopqrs33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 0, '3', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 5, '3', S("abcdefghijklmnopqrs33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 10, '3', S("abcdefghijklmnopqrs3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 20, '3', S("abcdefghijklmnopqrs33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 5, '3', S("abcdefghijklmnopqrst33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 10, '3', S("abcdefghijklmnopqrst3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333"));
|
||||
TEST_CONSTEXPR_CXX20 void test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '3', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 5, '3', S("abcdefghij33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 10, '3', S("abcdefghij3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 20, '3', S("abcdefghij33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 5, '3', S("abcdefghijklmnopqrs33333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 10, '3', S("abcdefghijklmnopqrs3333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 20, '3', S("abcdefghijklmnopqrs33333333333333333333t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 0, '3', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 5, '3', S("abcdefghijklmnopqrs33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 10, '3', S("abcdefghijklmnopqrs3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 20, '3', S("abcdefghijklmnopqrs33333333333333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 0, '3', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 5, '3', S("abcdefghijklmnopqrst33333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 10, '3', S("abcdefghijklmnopqrst3333333333"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333"));
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
@@ -284,8 +284,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
@@ -19,255 +19,250 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected)
|
||||
{
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = str.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) {
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = str.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
test(S(""), 0, 0, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, S("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, S(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, S("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, S(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, S("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, S("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, S(""), S("e"));
|
||||
test(S("abcde"), 0, 4, S("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, S("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, S(""), S(""));
|
||||
test(S("abcde"), 0, 5, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, S("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, S(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, S("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, S("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, S(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, S("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, S("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, S("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, S(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, S("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, S("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, S("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, S(""), S("a"));
|
||||
test(S("abcde"), 1, 4, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, S("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, S("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, S("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, S(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, S("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, S("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, S("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, S(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, S("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, S("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, S("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, S("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, S("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, S(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, S(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, S("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
test(S(""), 0, 0, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, S("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, S(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, S("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, S(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, S("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, S("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, S(""), S("e"));
|
||||
test(S("abcde"), 0, 4, S("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, S("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, S(""), S(""));
|
||||
test(S("abcde"), 0, 5, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, S("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, S(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, S("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, S("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, S(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, S("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, S("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, S("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, S(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, S("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, S("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, S("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, S(""), S("a"));
|
||||
test(S("abcde"), 1, 4, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, S("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, S("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, S("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, S(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, S("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, S("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, S("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, S(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, S("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, S("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, S("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, S("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, S("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, S(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, S(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, S("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, S(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, S(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, S(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, S(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, S("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, S(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, S(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, S(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, S(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, S("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -293,8 +288,7 @@ void test() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
@@ -19,255 +19,250 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected)
|
||||
{
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = sv.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) {
|
||||
typename S::size_type old_size = s.size();
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = sv.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, SV(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, SV(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, SV(""), S("e"));
|
||||
test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, SV(""), S(""));
|
||||
test(S("abcde"), 0, 5, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, SV(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, SV(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, SV(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, SV(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, SV(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, SV(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, SV(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, SV(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, SV(""), S("e"));
|
||||
test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, SV(""), S(""));
|
||||
test(S("abcde"), 0, 5, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, SV(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, SV(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, SV(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, SV(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, SV(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, SV(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 void test() {
|
||||
@@ -290,17 +285,16 @@ TEST_CONSTEXPR_CXX20 void test() {
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
#if TEST_STD_VER > 17
|
||||
# if TEST_STD_VER > 17
|
||||
static_assert(test0<S, SV>());
|
||||
static_assert(test1<S, SV>());
|
||||
static_assert(test2<S, SV>());
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
return 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -21,352 +21,342 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
const typename S::value_type* str, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.replace(pos, n1, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
typename S::size_type rlen = S::traits_type::length(str);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
test(S s, typename S::size_type pos, typename S::size_type n1, const typename S::value_type* str, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.replace(pos, n1, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
typename S::size_type rlen = S::traits_type::length(str);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.replace(pos, n1, str);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.replace(pos, n1, str);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
test(S(""), 0, 0, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 0, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S(""), 0, 1, "", S(""));
|
||||
test(S(""), 0, 1, "12345", S("12345"));
|
||||
test(S(""), 0, 1, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 1, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S(""), 1, 0, "", S("can't happen"));
|
||||
test(S(""), 1, 0, "12345", S("can't happen"));
|
||||
test(S(""), 1, 0, "1234567890", S("can't happen"));
|
||||
test(S(""), 1, 0, "12345678901234567890", S("can't happen"));
|
||||
test(S("abcde"), 0, 0, "", S("abcde"));
|
||||
test(S("abcde"), 0, 0, "12345", S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, "1234567890", S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, "12345678901234567890", S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, "", S("bcde"));
|
||||
test(S("abcde"), 0, 1, "12345", S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, "1234567890", S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, "12345678901234567890", S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, "", S("cde"));
|
||||
test(S("abcde"), 0, 2, "12345", S("12345cde"));
|
||||
test(S("abcde"), 0, 2, "1234567890", S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, "12345678901234567890", S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, "", S("e"));
|
||||
test(S("abcde"), 0, 4, "12345", S("12345e"));
|
||||
test(S("abcde"), 0, 4, "1234567890", S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, "12345678901234567890", S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, "", S(""));
|
||||
test(S("abcde"), 0, 5, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 5, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 5, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, "", S(""));
|
||||
test(S("abcde"), 0, 6, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 6, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 6, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, "", S("abcde"));
|
||||
test(S("abcde"), 1, 0, "12345", S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, "1234567890", S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, "12345678901234567890", S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, "", S("acde"));
|
||||
test(S("abcde"), 1, 1, "12345", S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, "1234567890", S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, "12345678901234567890", S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, "", S("ade"));
|
||||
test(S("abcde"), 1, 2, "12345", S("a12345de"));
|
||||
test(S("abcde"), 1, 2, "1234567890", S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, "12345678901234567890", S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, "", S("ae"));
|
||||
test(S("abcde"), 1, 3, "12345", S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, "12345678901234567890", S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, "", S("a"));
|
||||
test(S("abcde"), 1, 4, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 4, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, "", S("a"));
|
||||
test(S("abcde"), 1, 5, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 5, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, "", S("abcde"));
|
||||
test(S("abcde"), 2, 0, "12345", S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, "1234567890", S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, "12345678901234567890", S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, "", S("abde"));
|
||||
test(S("abcde"), 2, 1, "12345", S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, "12345678901234567890", S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, "", S("abe"));
|
||||
test(S("abcde"), 2, 2, "12345", S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, "1234567890", S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, "12345678901234567890", S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, "", S("ab"));
|
||||
test(S("abcde"), 2, 3, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 3, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, "", S("ab"));
|
||||
test(S("abcde"), 2, 4, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 4, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, "", S("abcde"));
|
||||
test(S("abcde"), 4, 0, "12345", S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, "1234567890", S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, "12345678901234567890", S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, "", S("abcd"));
|
||||
test(S("abcde"), 4, 1, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, "", S("abcd"));
|
||||
test(S("abcde"), 4, 2, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, "", S("abcde"));
|
||||
test(S("abcde"), 5, 0, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, "", S("abcde"));
|
||||
test(S("abcde"), 5, 1, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
test(S(""), 0, 0, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 0, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S(""), 0, 1, "", S(""));
|
||||
test(S(""), 0, 1, "12345", S("12345"));
|
||||
test(S(""), 0, 1, "1234567890", S("1234567890"));
|
||||
test(S(""), 0, 1, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S(""), 1, 0, "", S("can't happen"));
|
||||
test(S(""), 1, 0, "12345", S("can't happen"));
|
||||
test(S(""), 1, 0, "1234567890", S("can't happen"));
|
||||
test(S(""), 1, 0, "12345678901234567890", S("can't happen"));
|
||||
test(S("abcde"), 0, 0, "", S("abcde"));
|
||||
test(S("abcde"), 0, 0, "12345", S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, "1234567890", S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, "12345678901234567890", S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, "", S("bcde"));
|
||||
test(S("abcde"), 0, 1, "12345", S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, "1234567890", S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, "12345678901234567890", S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, "", S("cde"));
|
||||
test(S("abcde"), 0, 2, "12345", S("12345cde"));
|
||||
test(S("abcde"), 0, 2, "1234567890", S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, "12345678901234567890", S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, "", S("e"));
|
||||
test(S("abcde"), 0, 4, "12345", S("12345e"));
|
||||
test(S("abcde"), 0, 4, "1234567890", S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, "12345678901234567890", S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, "", S(""));
|
||||
test(S("abcde"), 0, 5, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 5, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 5, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, "", S(""));
|
||||
test(S("abcde"), 0, 6, "12345", S("12345"));
|
||||
test(S("abcde"), 0, 6, "1234567890", S("1234567890"));
|
||||
test(S("abcde"), 0, 6, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, "", S("abcde"));
|
||||
test(S("abcde"), 1, 0, "12345", S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, "1234567890", S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, "12345678901234567890", S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, "", S("acde"));
|
||||
test(S("abcde"), 1, 1, "12345", S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, "1234567890", S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, "12345678901234567890", S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, "", S("ade"));
|
||||
test(S("abcde"), 1, 2, "12345", S("a12345de"));
|
||||
test(S("abcde"), 1, 2, "1234567890", S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, "12345678901234567890", S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, "", S("ae"));
|
||||
test(S("abcde"), 1, 3, "12345", S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, "12345678901234567890", S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, "", S("a"));
|
||||
test(S("abcde"), 1, 4, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 4, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, "", S("a"));
|
||||
test(S("abcde"), 1, 5, "12345", S("a12345"));
|
||||
test(S("abcde"), 1, 5, "1234567890", S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, "", S("abcde"));
|
||||
test(S("abcde"), 2, 0, "12345", S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, "1234567890", S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, "12345678901234567890", S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, "", S("abde"));
|
||||
test(S("abcde"), 2, 1, "12345", S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, "12345678901234567890", S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, "", S("abe"));
|
||||
test(S("abcde"), 2, 2, "12345", S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, "1234567890", S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, "12345678901234567890", S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, "", S("ab"));
|
||||
test(S("abcde"), 2, 3, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 3, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, "", S("ab"));
|
||||
test(S("abcde"), 2, 4, "12345", S("ab12345"));
|
||||
test(S("abcde"), 2, 4, "1234567890", S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, "12345678901234567890", S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, "", S("abcde"));
|
||||
test(S("abcde"), 4, 0, "12345", S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, "1234567890", S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, "12345678901234567890", S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, "", S("abcd"));
|
||||
test(S("abcde"), 4, 1, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, "", S("abcd"));
|
||||
test(S("abcde"), 4, 2, "12345", S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, "1234567890", S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, "12345678901234567890", S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, "", S("abcde"));
|
||||
test(S("abcde"), 5, 0, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, "", S("abcde"));
|
||||
test(S("abcde"), 5, 1, "12345", S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, "", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345678901234567890", S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345", S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "", S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345", S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "1234567890", S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, "", S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345", S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "1234567890", S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345678901234567890", S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, "", S("j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345", S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, "1234567890", S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345678901234567890", S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, "", S(""));
|
||||
test(S("abcdefghij"), 0, 10, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, "", S(""));
|
||||
test(S("abcdefghij"), 0, 11, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345", S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "1234567890", S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "", S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345", S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "1234567890", S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, "", S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "1234567890", S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345678901234567890", S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, "", S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, "12345", S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, "1234567890", S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, "12345678901234567890", S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 9, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 10, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345", S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "1234567890", S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345678901234567890", S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, "", S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345", S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "1234567890", S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345678901234567890", S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, "", S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345", S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, "1234567890", S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345678901234567890", S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, "", S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, "1234567890", S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345678901234567890", S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, "12345", S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, "1234567890", S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, "12345678901234567890", S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, "", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345678901234567890", S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcde"), 6, 0, "", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345678901234567890", S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345", S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "", S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345", S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "1234567890", S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, "", S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345", S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "1234567890", S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, "12345678901234567890", S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, "", S("j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345", S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, "1234567890", S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, "12345678901234567890", S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, "", S(""));
|
||||
test(S("abcdefghij"), 0, 10, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, "", S(""));
|
||||
test(S("abcdefghij"), 0, 11, "12345", S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345", S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "1234567890", S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "", S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345", S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "1234567890", S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, "", S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "1234567890", S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345678901234567890", S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, "", S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, "12345", S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, "1234567890", S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, "12345678901234567890", S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 9, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, "", S("a"));
|
||||
test(S("abcdefghij"), 1, 10, "12345", S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345", S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "1234567890", S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, "12345678901234567890", S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, "", S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345", S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "1234567890", S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, "12345678901234567890", S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, "", S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345", S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, "1234567890", S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, "12345678901234567890", S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, "", S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, "1234567890", S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345678901234567890", S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, "", S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, "12345", S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, "1234567890", S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, "12345678901234567890", S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, "12345", S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, "1234567890", S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, "12345678901234567890", S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, "", S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, "12345", S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, "1234567890", S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, "12345678901234567890", S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, "", S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, "", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345678901234567890", S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "", S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345", S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "", S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345", S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "", S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345", S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "", S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345", S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "", S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345", S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "", S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345", S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345", S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "", S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345", S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "", S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345", S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "", S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345", S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345", S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "", S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345", S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "", S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345", S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "", S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345", S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "", S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "12345", S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "", S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345", S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "", S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345", S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "", S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345", S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "", S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "12345", S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345", S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "", S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345", S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "", S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345", S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "", S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345", S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "12345", S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345", S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "", S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "12345", S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "12345", S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -383,8 +373,7 @@ void test() {
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,353 +21,347 @@
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
typename S::size_type n2, typename S::value_type c,
|
||||
S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size)
|
||||
{
|
||||
s.replace(pos, n1, n2, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
test(S s,
|
||||
typename S::size_type pos,
|
||||
typename S::size_type n1,
|
||||
typename S::size_type n2,
|
||||
typename S::value_type c,
|
||||
S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos <= old_size) {
|
||||
s.replace(pos, n1, n2, c);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.replace(pos, n1, n2, c);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.replace(pos, n1, n2, c);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, 0, '2', S(""));
|
||||
test(S(""), 0, 0, 5, '2', S("22222"));
|
||||
test(S(""), 0, 0, 10, '2', S("2222222222"));
|
||||
test(S(""), 0, 0, 20, '2', S("22222222222222222222"));
|
||||
test(S(""), 0, 1, 0, '2', S(""));
|
||||
test(S(""), 0, 1, 5, '2', S("22222"));
|
||||
test(S(""), 0, 1, 10, '2', S("2222222222"));
|
||||
test(S(""), 0, 1, 20, '2', S("22222222222222222222"));
|
||||
test(S(""), 1, 0, 0, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 5, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 10, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 20, '2', S("can't happen"));
|
||||
test(S("abcde"), 0, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 0, 0, 5, '2', S("22222abcde"));
|
||||
test(S("abcde"), 0, 0, 10, '2', S("2222222222abcde"));
|
||||
test(S("abcde"), 0, 0, 20, '2', S("22222222222222222222abcde"));
|
||||
test(S("abcde"), 0, 1, 0, '2', S("bcde"));
|
||||
test(S("abcde"), 0, 1, 5, '2', S("22222bcde"));
|
||||
test(S("abcde"), 0, 1, 10, '2', S("2222222222bcde"));
|
||||
test(S("abcde"), 0, 1, 20, '2', S("22222222222222222222bcde"));
|
||||
test(S("abcde"), 0, 2, 0, '2', S("cde"));
|
||||
test(S("abcde"), 0, 2, 5, '2', S("22222cde"));
|
||||
test(S("abcde"), 0, 2, 10, '2', S("2222222222cde"));
|
||||
test(S("abcde"), 0, 2, 20, '2', S("22222222222222222222cde"));
|
||||
test(S("abcde"), 0, 4, 0, '2', S("e"));
|
||||
test(S("abcde"), 0, 4, 5, '2', S("22222e"));
|
||||
test(S("abcde"), 0, 4, 10, '2', S("2222222222e"));
|
||||
test(S("abcde"), 0, 4, 20, '2', S("22222222222222222222e"));
|
||||
test(S("abcde"), 0, 5, 0, '2', S(""));
|
||||
test(S("abcde"), 0, 5, 5, '2', S("22222"));
|
||||
test(S("abcde"), 0, 5, 10, '2', S("2222222222"));
|
||||
test(S("abcde"), 0, 5, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcde"), 0, 6, 0, '2', S(""));
|
||||
test(S("abcde"), 0, 6, 5, '2', S("22222"));
|
||||
test(S("abcde"), 0, 6, 10, '2', S("2222222222"));
|
||||
test(S("abcde"), 0, 6, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcde"), 1, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 1, 0, 5, '2', S("a22222bcde"));
|
||||
test(S("abcde"), 1, 0, 10, '2', S("a2222222222bcde"));
|
||||
test(S("abcde"), 1, 0, 20, '2', S("a22222222222222222222bcde"));
|
||||
test(S("abcde"), 1, 1, 0, '2', S("acde"));
|
||||
test(S("abcde"), 1, 1, 5, '2', S("a22222cde"));
|
||||
test(S("abcde"), 1, 1, 10, '2', S("a2222222222cde"));
|
||||
test(S("abcde"), 1, 1, 20, '2', S("a22222222222222222222cde"));
|
||||
test(S("abcde"), 1, 2, 0, '2', S("ade"));
|
||||
test(S("abcde"), 1, 2, 5, '2', S("a22222de"));
|
||||
test(S("abcde"), 1, 2, 10, '2', S("a2222222222de"));
|
||||
test(S("abcde"), 1, 2, 20, '2', S("a22222222222222222222de"));
|
||||
test(S("abcde"), 1, 3, 0, '2', S("ae"));
|
||||
test(S("abcde"), 1, 3, 5, '2', S("a22222e"));
|
||||
test(S("abcde"), 1, 3, 10, '2', S("a2222222222e"));
|
||||
test(S("abcde"), 1, 3, 20, '2', S("a22222222222222222222e"));
|
||||
test(S("abcde"), 1, 4, 0, '2', S("a"));
|
||||
test(S("abcde"), 1, 4, 5, '2', S("a22222"));
|
||||
test(S("abcde"), 1, 4, 10, '2', S("a2222222222"));
|
||||
test(S("abcde"), 1, 4, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcde"), 1, 5, 0, '2', S("a"));
|
||||
test(S("abcde"), 1, 5, 5, '2', S("a22222"));
|
||||
test(S("abcde"), 1, 5, 10, '2', S("a2222222222"));
|
||||
test(S("abcde"), 1, 5, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcde"), 2, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 2, 0, 5, '2', S("ab22222cde"));
|
||||
test(S("abcde"), 2, 0, 10, '2', S("ab2222222222cde"));
|
||||
test(S("abcde"), 2, 0, 20, '2', S("ab22222222222222222222cde"));
|
||||
test(S("abcde"), 2, 1, 0, '2', S("abde"));
|
||||
test(S("abcde"), 2, 1, 5, '2', S("ab22222de"));
|
||||
test(S("abcde"), 2, 1, 10, '2', S("ab2222222222de"));
|
||||
test(S("abcde"), 2, 1, 20, '2', S("ab22222222222222222222de"));
|
||||
test(S("abcde"), 2, 2, 0, '2', S("abe"));
|
||||
test(S("abcde"), 2, 2, 5, '2', S("ab22222e"));
|
||||
test(S("abcde"), 2, 2, 10, '2', S("ab2222222222e"));
|
||||
test(S("abcde"), 2, 2, 20, '2', S("ab22222222222222222222e"));
|
||||
test(S("abcde"), 2, 3, 0, '2', S("ab"));
|
||||
test(S("abcde"), 2, 3, 5, '2', S("ab22222"));
|
||||
test(S("abcde"), 2, 3, 10, '2', S("ab2222222222"));
|
||||
test(S("abcde"), 2, 3, 20, '2', S("ab22222222222222222222"));
|
||||
test(S("abcde"), 2, 4, 0, '2', S("ab"));
|
||||
test(S("abcde"), 2, 4, 5, '2', S("ab22222"));
|
||||
test(S("abcde"), 2, 4, 10, '2', S("ab2222222222"));
|
||||
test(S("abcde"), 2, 4, 20, '2', S("ab22222222222222222222"));
|
||||
test(S("abcde"), 4, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 4, 0, 5, '2', S("abcd22222e"));
|
||||
test(S("abcde"), 4, 0, 10, '2', S("abcd2222222222e"));
|
||||
test(S("abcde"), 4, 0, 20, '2', S("abcd22222222222222222222e"));
|
||||
test(S("abcde"), 4, 1, 0, '2', S("abcd"));
|
||||
test(S("abcde"), 4, 1, 5, '2', S("abcd22222"));
|
||||
test(S("abcde"), 4, 1, 10, '2', S("abcd2222222222"));
|
||||
test(S("abcde"), 4, 1, 20, '2', S("abcd22222222222222222222"));
|
||||
test(S("abcde"), 4, 2, 0, '2', S("abcd"));
|
||||
test(S("abcde"), 4, 2, 5, '2', S("abcd22222"));
|
||||
test(S("abcde"), 4, 2, 10, '2', S("abcd2222222222"));
|
||||
test(S("abcde"), 4, 2, 20, '2', S("abcd22222222222222222222"));
|
||||
test(S("abcde"), 5, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 5, 0, 5, '2', S("abcde22222"));
|
||||
test(S("abcde"), 5, 0, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcde"), 5, 0, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcde"), 5, 1, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 5, 1, 5, '2', S("abcde22222"));
|
||||
test(S("abcde"), 5, 1, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, 0, '2', S(""));
|
||||
test(S(""), 0, 0, 5, '2', S("22222"));
|
||||
test(S(""), 0, 0, 10, '2', S("2222222222"));
|
||||
test(S(""), 0, 0, 20, '2', S("22222222222222222222"));
|
||||
test(S(""), 0, 1, 0, '2', S(""));
|
||||
test(S(""), 0, 1, 5, '2', S("22222"));
|
||||
test(S(""), 0, 1, 10, '2', S("2222222222"));
|
||||
test(S(""), 0, 1, 20, '2', S("22222222222222222222"));
|
||||
test(S(""), 1, 0, 0, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 5, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 10, '2', S("can't happen"));
|
||||
test(S(""), 1, 0, 20, '2', S("can't happen"));
|
||||
test(S("abcde"), 0, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 0, 0, 5, '2', S("22222abcde"));
|
||||
test(S("abcde"), 0, 0, 10, '2', S("2222222222abcde"));
|
||||
test(S("abcde"), 0, 0, 20, '2', S("22222222222222222222abcde"));
|
||||
test(S("abcde"), 0, 1, 0, '2', S("bcde"));
|
||||
test(S("abcde"), 0, 1, 5, '2', S("22222bcde"));
|
||||
test(S("abcde"), 0, 1, 10, '2', S("2222222222bcde"));
|
||||
test(S("abcde"), 0, 1, 20, '2', S("22222222222222222222bcde"));
|
||||
test(S("abcde"), 0, 2, 0, '2', S("cde"));
|
||||
test(S("abcde"), 0, 2, 5, '2', S("22222cde"));
|
||||
test(S("abcde"), 0, 2, 10, '2', S("2222222222cde"));
|
||||
test(S("abcde"), 0, 2, 20, '2', S("22222222222222222222cde"));
|
||||
test(S("abcde"), 0, 4, 0, '2', S("e"));
|
||||
test(S("abcde"), 0, 4, 5, '2', S("22222e"));
|
||||
test(S("abcde"), 0, 4, 10, '2', S("2222222222e"));
|
||||
test(S("abcde"), 0, 4, 20, '2', S("22222222222222222222e"));
|
||||
test(S("abcde"), 0, 5, 0, '2', S(""));
|
||||
test(S("abcde"), 0, 5, 5, '2', S("22222"));
|
||||
test(S("abcde"), 0, 5, 10, '2', S("2222222222"));
|
||||
test(S("abcde"), 0, 5, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcde"), 0, 6, 0, '2', S(""));
|
||||
test(S("abcde"), 0, 6, 5, '2', S("22222"));
|
||||
test(S("abcde"), 0, 6, 10, '2', S("2222222222"));
|
||||
test(S("abcde"), 0, 6, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcde"), 1, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 1, 0, 5, '2', S("a22222bcde"));
|
||||
test(S("abcde"), 1, 0, 10, '2', S("a2222222222bcde"));
|
||||
test(S("abcde"), 1, 0, 20, '2', S("a22222222222222222222bcde"));
|
||||
test(S("abcde"), 1, 1, 0, '2', S("acde"));
|
||||
test(S("abcde"), 1, 1, 5, '2', S("a22222cde"));
|
||||
test(S("abcde"), 1, 1, 10, '2', S("a2222222222cde"));
|
||||
test(S("abcde"), 1, 1, 20, '2', S("a22222222222222222222cde"));
|
||||
test(S("abcde"), 1, 2, 0, '2', S("ade"));
|
||||
test(S("abcde"), 1, 2, 5, '2', S("a22222de"));
|
||||
test(S("abcde"), 1, 2, 10, '2', S("a2222222222de"));
|
||||
test(S("abcde"), 1, 2, 20, '2', S("a22222222222222222222de"));
|
||||
test(S("abcde"), 1, 3, 0, '2', S("ae"));
|
||||
test(S("abcde"), 1, 3, 5, '2', S("a22222e"));
|
||||
test(S("abcde"), 1, 3, 10, '2', S("a2222222222e"));
|
||||
test(S("abcde"), 1, 3, 20, '2', S("a22222222222222222222e"));
|
||||
test(S("abcde"), 1, 4, 0, '2', S("a"));
|
||||
test(S("abcde"), 1, 4, 5, '2', S("a22222"));
|
||||
test(S("abcde"), 1, 4, 10, '2', S("a2222222222"));
|
||||
test(S("abcde"), 1, 4, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcde"), 1, 5, 0, '2', S("a"));
|
||||
test(S("abcde"), 1, 5, 5, '2', S("a22222"));
|
||||
test(S("abcde"), 1, 5, 10, '2', S("a2222222222"));
|
||||
test(S("abcde"), 1, 5, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcde"), 2, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 2, 0, 5, '2', S("ab22222cde"));
|
||||
test(S("abcde"), 2, 0, 10, '2', S("ab2222222222cde"));
|
||||
test(S("abcde"), 2, 0, 20, '2', S("ab22222222222222222222cde"));
|
||||
test(S("abcde"), 2, 1, 0, '2', S("abde"));
|
||||
test(S("abcde"), 2, 1, 5, '2', S("ab22222de"));
|
||||
test(S("abcde"), 2, 1, 10, '2', S("ab2222222222de"));
|
||||
test(S("abcde"), 2, 1, 20, '2', S("ab22222222222222222222de"));
|
||||
test(S("abcde"), 2, 2, 0, '2', S("abe"));
|
||||
test(S("abcde"), 2, 2, 5, '2', S("ab22222e"));
|
||||
test(S("abcde"), 2, 2, 10, '2', S("ab2222222222e"));
|
||||
test(S("abcde"), 2, 2, 20, '2', S("ab22222222222222222222e"));
|
||||
test(S("abcde"), 2, 3, 0, '2', S("ab"));
|
||||
test(S("abcde"), 2, 3, 5, '2', S("ab22222"));
|
||||
test(S("abcde"), 2, 3, 10, '2', S("ab2222222222"));
|
||||
test(S("abcde"), 2, 3, 20, '2', S("ab22222222222222222222"));
|
||||
test(S("abcde"), 2, 4, 0, '2', S("ab"));
|
||||
test(S("abcde"), 2, 4, 5, '2', S("ab22222"));
|
||||
test(S("abcde"), 2, 4, 10, '2', S("ab2222222222"));
|
||||
test(S("abcde"), 2, 4, 20, '2', S("ab22222222222222222222"));
|
||||
test(S("abcde"), 4, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 4, 0, 5, '2', S("abcd22222e"));
|
||||
test(S("abcde"), 4, 0, 10, '2', S("abcd2222222222e"));
|
||||
test(S("abcde"), 4, 0, 20, '2', S("abcd22222222222222222222e"));
|
||||
test(S("abcde"), 4, 1, 0, '2', S("abcd"));
|
||||
test(S("abcde"), 4, 1, 5, '2', S("abcd22222"));
|
||||
test(S("abcde"), 4, 1, 10, '2', S("abcd2222222222"));
|
||||
test(S("abcde"), 4, 1, 20, '2', S("abcd22222222222222222222"));
|
||||
test(S("abcde"), 4, 2, 0, '2', S("abcd"));
|
||||
test(S("abcde"), 4, 2, 5, '2', S("abcd22222"));
|
||||
test(S("abcde"), 4, 2, 10, '2', S("abcd2222222222"));
|
||||
test(S("abcde"), 4, 2, 20, '2', S("abcd22222222222222222222"));
|
||||
test(S("abcde"), 5, 0, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 5, 0, 5, '2', S("abcde22222"));
|
||||
test(S("abcde"), 5, 0, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcde"), 5, 0, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcde"), 5, 1, 0, '2', S("abcde"));
|
||||
test(S("abcde"), 5, 1, 5, '2', S("abcde22222"));
|
||||
test(S("abcde"), 5, 1, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 20, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 5, '2', S("22222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 10, '2', S("2222222222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 20, '2', S("22222222222222222222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 0, '2', S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 5, '2', S("22222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 10, '2', S("2222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 20, '2', S("22222222222222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, 0, '2', S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 5, '2', S("22222fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 10, '2', S("2222222222fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 20, '2', S("22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 0, 9, 0, '2', S("j"));
|
||||
test(S("abcdefghij"), 0, 9, 5, '2', S("22222j"));
|
||||
test(S("abcdefghij"), 0, 9, 10, '2', S("2222222222j"));
|
||||
test(S("abcdefghij"), 0, 9, 20, '2', S("22222222222222222222j"));
|
||||
test(S("abcdefghij"), 0, 10, 0, '2', S(""));
|
||||
test(S("abcdefghij"), 0, 10, 5, '2', S("22222"));
|
||||
test(S("abcdefghij"), 0, 10, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghij"), 0, 10, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghij"), 0, 11, 0, '2', S(""));
|
||||
test(S("abcdefghij"), 0, 11, 5, '2', S("22222"));
|
||||
test(S("abcdefghij"), 0, 11, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghij"), 0, 11, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghij"), 1, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 5, '2', S("a22222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 10, '2', S("a2222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 20, '2', S("a22222222222222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 0, '2', S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 5, '2', S("a22222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 10, '2', S("a2222222222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 20, '2', S("a22222222222222222222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, 0, '2', S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, 5, '2', S("a22222fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 10, '2', S("a2222222222fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 20, '2', S("a22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 1, 8, 0, '2', S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, 5, '2', S("a22222j"));
|
||||
test(S("abcdefghij"), 1, 8, 10, '2', S("a2222222222j"));
|
||||
test(S("abcdefghij"), 1, 8, 20, '2', S("a22222222222222222222j"));
|
||||
test(S("abcdefghij"), 1, 9, 0, '2', S("a"));
|
||||
test(S("abcdefghij"), 1, 9, 5, '2', S("a22222"));
|
||||
test(S("abcdefghij"), 1, 9, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghij"), 1, 9, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghij"), 1, 10, 0, '2', S("a"));
|
||||
test(S("abcdefghij"), 1, 10, 5, '2', S("a22222"));
|
||||
test(S("abcdefghij"), 1, 10, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghij"), 1, 10, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghij"), 5, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, 5, '2', S("abcde22222fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 10, '2', S("abcde2222222222fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 20, '2', S("abcde22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 5, 1, 0, '2', S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, 5, '2', S("abcde22222ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 10, '2', S("abcde2222222222ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 20, '2', S("abcde22222222222222222222ghij"));
|
||||
test(S("abcdefghij"), 5, 2, 0, '2', S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, 5, '2', S("abcde22222hij"));
|
||||
test(S("abcdefghij"), 5, 2, 10, '2', S("abcde2222222222hij"));
|
||||
test(S("abcdefghij"), 5, 2, 20, '2', S("abcde22222222222222222222hij"));
|
||||
test(S("abcdefghij"), 5, 4, 0, '2', S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, 5, '2', S("abcde22222j"));
|
||||
test(S("abcdefghij"), 5, 4, 10, '2', S("abcde2222222222j"));
|
||||
test(S("abcdefghij"), 5, 4, 20, '2', S("abcde22222222222222222222j"));
|
||||
test(S("abcdefghij"), 5, 5, 0, '2', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, 5, '2', S("abcde22222"));
|
||||
test(S("abcdefghij"), 5, 5, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcdefghij"), 5, 5, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcdefghij"), 5, 6, 0, '2', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, 5, '2', S("abcde22222"));
|
||||
test(S("abcdefghij"), 5, 6, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcdefghij"), 5, 6, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcdefghij"), 9, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, 5, '2', S("abcdefghi22222j"));
|
||||
test(S("abcdefghij"), 9, 0, 10, '2', S("abcdefghi2222222222j"));
|
||||
test(S("abcdefghij"), 9, 0, 20, '2', S("abcdefghi22222222222222222222j"));
|
||||
test(S("abcdefghij"), 9, 1, 0, '2', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, 5, '2', S("abcdefghi22222"));
|
||||
test(S("abcdefghij"), 9, 1, 10, '2', S("abcdefghi2222222222"));
|
||||
test(S("abcdefghij"), 9, 1, 20, '2', S("abcdefghi22222222222222222222"));
|
||||
test(S("abcdefghij"), 9, 2, 0, '2', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, 5, '2', S("abcdefghi22222"));
|
||||
test(S("abcdefghij"), 9, 2, 10, '2', S("abcdefghi2222222222"));
|
||||
test(S("abcdefghij"), 9, 2, 20, '2', S("abcdefghi22222222222222222222"));
|
||||
test(S("abcdefghij"), 10, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghij"), 10, 0, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghij"), 10, 0, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghij"), 10, 1, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghij"), 10, 1, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghij"), 10, 1, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghij"), 11, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 20, '2', S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcde"), 6, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 20, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 5, '2', S("22222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 10, '2', S("2222222222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, 20, '2', S("22222222222222222222abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 0, '2', S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 5, '2', S("22222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 10, '2', S("2222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, 20, '2', S("22222222222222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, 0, '2', S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 5, '2', S("22222fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 10, '2', S("2222222222fghij"));
|
||||
test(S("abcdefghij"), 0, 5, 20, '2', S("22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 0, 9, 0, '2', S("j"));
|
||||
test(S("abcdefghij"), 0, 9, 5, '2', S("22222j"));
|
||||
test(S("abcdefghij"), 0, 9, 10, '2', S("2222222222j"));
|
||||
test(S("abcdefghij"), 0, 9, 20, '2', S("22222222222222222222j"));
|
||||
test(S("abcdefghij"), 0, 10, 0, '2', S(""));
|
||||
test(S("abcdefghij"), 0, 10, 5, '2', S("22222"));
|
||||
test(S("abcdefghij"), 0, 10, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghij"), 0, 10, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghij"), 0, 11, 0, '2', S(""));
|
||||
test(S("abcdefghij"), 0, 11, 5, '2', S("22222"));
|
||||
test(S("abcdefghij"), 0, 11, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghij"), 0, 11, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghij"), 1, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 5, '2', S("a22222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 10, '2', S("a2222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, 20, '2', S("a22222222222222222222bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 0, '2', S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 5, '2', S("a22222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 10, '2', S("a2222222222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, 20, '2', S("a22222222222222222222cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, 0, '2', S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, 5, '2', S("a22222fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 10, '2', S("a2222222222fghij"));
|
||||
test(S("abcdefghij"), 1, 4, 20, '2', S("a22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 1, 8, 0, '2', S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, 5, '2', S("a22222j"));
|
||||
test(S("abcdefghij"), 1, 8, 10, '2', S("a2222222222j"));
|
||||
test(S("abcdefghij"), 1, 8, 20, '2', S("a22222222222222222222j"));
|
||||
test(S("abcdefghij"), 1, 9, 0, '2', S("a"));
|
||||
test(S("abcdefghij"), 1, 9, 5, '2', S("a22222"));
|
||||
test(S("abcdefghij"), 1, 9, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghij"), 1, 9, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghij"), 1, 10, 0, '2', S("a"));
|
||||
test(S("abcdefghij"), 1, 10, 5, '2', S("a22222"));
|
||||
test(S("abcdefghij"), 1, 10, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghij"), 1, 10, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghij"), 5, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, 5, '2', S("abcde22222fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 10, '2', S("abcde2222222222fghij"));
|
||||
test(S("abcdefghij"), 5, 0, 20, '2', S("abcde22222222222222222222fghij"));
|
||||
test(S("abcdefghij"), 5, 1, 0, '2', S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, 5, '2', S("abcde22222ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 10, '2', S("abcde2222222222ghij"));
|
||||
test(S("abcdefghij"), 5, 1, 20, '2', S("abcde22222222222222222222ghij"));
|
||||
test(S("abcdefghij"), 5, 2, 0, '2', S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, 5, '2', S("abcde22222hij"));
|
||||
test(S("abcdefghij"), 5, 2, 10, '2', S("abcde2222222222hij"));
|
||||
test(S("abcdefghij"), 5, 2, 20, '2', S("abcde22222222222222222222hij"));
|
||||
test(S("abcdefghij"), 5, 4, 0, '2', S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, 5, '2', S("abcde22222j"));
|
||||
test(S("abcdefghij"), 5, 4, 10, '2', S("abcde2222222222j"));
|
||||
test(S("abcdefghij"), 5, 4, 20, '2', S("abcde22222222222222222222j"));
|
||||
test(S("abcdefghij"), 5, 5, 0, '2', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, 5, '2', S("abcde22222"));
|
||||
test(S("abcdefghij"), 5, 5, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcdefghij"), 5, 5, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcdefghij"), 5, 6, 0, '2', S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, 5, '2', S("abcde22222"));
|
||||
test(S("abcdefghij"), 5, 6, 10, '2', S("abcde2222222222"));
|
||||
test(S("abcdefghij"), 5, 6, 20, '2', S("abcde22222222222222222222"));
|
||||
test(S("abcdefghij"), 9, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, 5, '2', S("abcdefghi22222j"));
|
||||
test(S("abcdefghij"), 9, 0, 10, '2', S("abcdefghi2222222222j"));
|
||||
test(S("abcdefghij"), 9, 0, 20, '2', S("abcdefghi22222222222222222222j"));
|
||||
test(S("abcdefghij"), 9, 1, 0, '2', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, 5, '2', S("abcdefghi22222"));
|
||||
test(S("abcdefghij"), 9, 1, 10, '2', S("abcdefghi2222222222"));
|
||||
test(S("abcdefghij"), 9, 1, 20, '2', S("abcdefghi22222222222222222222"));
|
||||
test(S("abcdefghij"), 9, 2, 0, '2', S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, 5, '2', S("abcdefghi22222"));
|
||||
test(S("abcdefghij"), 9, 2, 10, '2', S("abcdefghi2222222222"));
|
||||
test(S("abcdefghij"), 9, 2, 20, '2', S("abcdefghi22222222222222222222"));
|
||||
test(S("abcdefghij"), 10, 0, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghij"), 10, 0, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghij"), 10, 0, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghij"), 10, 1, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghij"), 10, 1, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghij"), 10, 1, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghij"), 11, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, 20, '2', S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '2', S("22222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 10, '2', S("2222222222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 20, '2', S("22222222222222222222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 0, '2', S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 5, '2', S("22222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 10, '2', S("2222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 20, '2', S("22222222222222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 0, '2', S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 5, '2', S("22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 10, '2', S("2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 20, '2', S("22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 0, '2', S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 5, '2', S("22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 10, '2', S("2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 20, '2', S("22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 0, '2', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 5, '2', S("22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 0, '2', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 5, '2', S("22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 5, '2', S("a22222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 10, '2', S("a2222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 20, '2', S("a22222222222222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 0, '2', S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 5, '2', S("a22222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 10, '2', S("a2222222222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 20, '2', S("a22222222222222222222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 0, '2', S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 5, '2', S("a22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 10, '2', S("a2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 20, '2', S("a22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 0, '2', S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 5, '2', S("a22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 10, '2', S("a2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 20, '2', S("a22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 0, '2', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 5, '2', S("a22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 0, '2', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 5, '2', S("a22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 5, '2', S("abcdefghij22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 10, '2', S("abcdefghij2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 20, '2', S("abcdefghij22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 0, '2', S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 5, '2', S("abcdefghij22222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 10, '2', S("abcdefghij2222222222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 20, '2', S("abcdefghij22222222222222222222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 0, '2', S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 5, '2', S("abcdefghij22222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 10, '2', S("abcdefghij2222222222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 20, '2', S("abcdefghij22222222222222222222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 0, '2', S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 5, '2', S("abcdefghij22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 10, '2', S("abcdefghij2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 20, '2', S("abcdefghij22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 5, '2', S("abcdefghijklmnopqrs22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 10, '2', S("abcdefghijklmnopqrs2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 20, '2', S("abcdefghijklmnopqrs22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 0, '2', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 5, '2', S("abcdefghijklmnopqrs22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 10, '2', S("abcdefghijklmnopqrs2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 20, '2', S("abcdefghijklmnopqrs22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 0, '2', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 5, '2', S("abcdefghijklmnopqrs22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 10, '2', S("abcdefghijklmnopqrs2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 20, '2', S("abcdefghijklmnopqrs22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 5, '2', S("abcdefghijklmnopqrst22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 10, '2', S("abcdefghijklmnopqrst2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '2', S("abcdefghijklmnopqrst22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 5, '2', S("abcdefghijklmnopqrst22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 10, '2', S("abcdefghijklmnopqrst2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 20, '2', S("abcdefghijklmnopqrst22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 20, '2', S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '2', S("22222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 10, '2', S("2222222222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 20, '2', S("22222222222222222222abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 0, '2', S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 5, '2', S("22222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 10, '2', S("2222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, 20, '2', S("22222222222222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 0, '2', S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 5, '2', S("22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 10, '2', S("2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, 20, '2', S("22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 0, '2', S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 5, '2', S("22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 10, '2', S("2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, 20, '2', S("22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 0, '2', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 5, '2', S("22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 0, '2', S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 5, '2', S("22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 10, '2', S("2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, 20, '2', S("22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 5, '2', S("a22222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 10, '2', S("a2222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, 20, '2', S("a22222222222222222222bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 0, '2', S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 5, '2', S("a22222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 10, '2', S("a2222222222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, 20, '2', S("a22222222222222222222cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 0, '2', S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 5, '2', S("a22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 10, '2', S("a2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, 20, '2', S("a22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 0, '2', S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 5, '2', S("a22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 10, '2', S("a2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, 20, '2', S("a22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 0, '2', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 5, '2', S("a22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 0, '2', S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 5, '2', S("a22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 10, '2', S("a2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, 20, '2', S("a22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 5, '2', S("abcdefghij22222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 10, '2', S("abcdefghij2222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, 20, '2', S("abcdefghij22222222222222222222klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 0, '2', S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 5, '2', S("abcdefghij22222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 10, '2', S("abcdefghij2222222222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, 20, '2', S("abcdefghij22222222222222222222lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 0, '2', S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 5, '2', S("abcdefghij22222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 10, '2', S("abcdefghij2222222222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, 20, '2', S("abcdefghij22222222222222222222pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 0, '2', S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 5, '2', S("abcdefghij22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 10, '2', S("abcdefghij2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, 20, '2', S("abcdefghij22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 0, '2', S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 5, '2', S("abcdefghij22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 10, '2', S("abcdefghij2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, 20, '2', S("abcdefghij22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 5, '2', S("abcdefghijklmnopqrs22222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 10, '2', S("abcdefghijklmnopqrs2222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, 20, '2', S("abcdefghijklmnopqrs22222222222222222222t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 0, '2', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 5, '2', S("abcdefghijklmnopqrs22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 10, '2', S("abcdefghijklmnopqrs2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, 20, '2', S("abcdefghijklmnopqrs22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 0, '2', S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 5, '2', S("abcdefghijklmnopqrs22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 10, '2', S("abcdefghijklmnopqrs2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, 20, '2', S("abcdefghijklmnopqrs22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 5, '2', S("abcdefghijklmnopqrst22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 10, '2', S("abcdefghijklmnopqrst2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '2', S("abcdefghijklmnopqrst22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 5, '2', S("abcdefghijklmnopqrst22222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 10, '2', S("abcdefghijklmnopqrst2222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, 20, '2', S("abcdefghijklmnopqrst22222222222222222222"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 5, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 10, '2', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 20, '2', S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -383,8 +377,7 @@ void test() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
@@ -20,352 +20,342 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos1 <= old_size)
|
||||
{
|
||||
s.replace(pos1, n1, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
typename S::size_type rlen = str.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos1 <= old_size) {
|
||||
s.replace(pos1, n1, str);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
typename S::size_type rlen = str.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.replace(pos1, n1, str);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos1 > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.replace(pos1, n1, str);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos1 > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
test(S(""), 0, 0, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 0, 1, S(""), S(""));
|
||||
test(S(""), 0, 1, S("12345"), S("12345"));
|
||||
test(S(""), 0, 1, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 1, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 1, 0, S(""), S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345"), S("can't happen"));
|
||||
test(S(""), 1, 0, S("1234567890"), S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcde"), 0, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, S("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, S(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, S("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, S(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, S("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, S("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, S(""), S("e"));
|
||||
test(S("abcde"), 0, 4, S("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, S("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, S(""), S(""));
|
||||
test(S("abcde"), 0, 5, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, S(""), S(""));
|
||||
test(S("abcde"), 0, 6, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 6, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 6, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, S("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, S(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, S("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, S("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, S(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, S("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, S("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, S("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, S(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, S("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, S("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, S("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, S(""), S("a"));
|
||||
test(S("abcde"), 1, 4, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, S(""), S("a"));
|
||||
test(S("abcde"), 1, 5, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 5, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, S("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, S("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, S("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, S(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, S("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, S("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, S("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, S(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, S("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, S("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 4, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 4, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, S("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, S("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, S("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 2, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 1, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
test(S(""), 0, 0, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 0, 1, S(""), S(""));
|
||||
test(S(""), 0, 1, S("12345"), S("12345"));
|
||||
test(S(""), 0, 1, S("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 1, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 1, 0, S(""), S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345"), S("can't happen"));
|
||||
test(S(""), 1, 0, S("1234567890"), S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcde"), 0, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, S("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, S(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, S("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, S(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, S("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, S("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, S(""), S("e"));
|
||||
test(S("abcde"), 0, 4, S("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, S("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, S(""), S(""));
|
||||
test(S("abcde"), 0, 5, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, S(""), S(""));
|
||||
test(S("abcde"), 0, 6, S("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 6, S("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 6, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, S("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, S(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, S("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, S("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, S(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, S("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, S("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, S("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, S(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, S("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, S("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, S("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, S(""), S("a"));
|
||||
test(S("abcde"), 1, 4, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, S(""), S("a"));
|
||||
test(S("abcde"), 1, 5, S("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 5, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, S("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, S("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, S("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, S(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, S("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, S("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, S("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, S(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, S("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, S("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, S(""), S("ab"));
|
||||
test(S("abcde"), 2, 4, S("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 4, S("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, S("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, S("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, S("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, S("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, S(""), S("abcd"));
|
||||
test(S("abcde"), 4, 2, S("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, S("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, S(""), S("abcde"));
|
||||
test(S("abcde"), 5, 1, S("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, S(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, S(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, S(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, S("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, S(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, S(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, S(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, S(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, S("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, S(""), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcde"), 6, 0, S(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, S(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, S(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, S("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, S(""), S(""));
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, S(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, S(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, S("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, S(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, S(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, S(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, S("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, S(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, S("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, S("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, S(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, S("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, S("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, S("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, S(""), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S(""), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S(""), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -391,8 +381,7 @@ void test() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,352 +20,342 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos1 <= old_size)
|
||||
{
|
||||
s.replace(pos1, n1, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
typename S::size_type rlen = sv.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) {
|
||||
const typename S::size_type old_size = s.size();
|
||||
S s0 = s;
|
||||
if (pos1 <= old_size) {
|
||||
s.replace(pos1, n1, sv);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
typename S::size_type rlen = sv.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.replace(pos1, n1, sv);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos1 > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
s.replace(pos1, n1, sv);
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos1 > old_size);
|
||||
assert(s == s0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 0, 1, SV(""), S(""));
|
||||
test(S(""), 0, 1, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 1, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 1, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 1, 0, SV(""), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("12345"), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcde"), 0, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, SV(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, SV(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, SV(""), S("e"));
|
||||
test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, SV(""), S(""));
|
||||
test(S("abcde"), 0, 5, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, SV(""), S(""));
|
||||
test(S("abcde"), 0, 6, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 6, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 6, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, SV(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, SV(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, SV(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 5, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 5, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, SV(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, SV(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 4, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 4, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 2, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 1, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
TEST_CONSTEXPR_CXX20 bool test0() {
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 0, 1, SV(""), S(""));
|
||||
test(S(""), 0, 1, SV("12345"), S("12345"));
|
||||
test(S(""), 0, 1, SV("1234567890"), S("1234567890"));
|
||||
test(S(""), 0, 1, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S(""), 1, 0, SV(""), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("12345"), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S(""), 1, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcde"), 0, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
|
||||
test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
|
||||
test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
|
||||
test(S("abcde"), 0, 1, SV(""), S("bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
|
||||
test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
|
||||
test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
|
||||
test(S("abcde"), 0, 2, SV(""), S("cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
|
||||
test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
|
||||
test(S("abcde"), 0, 4, SV(""), S("e"));
|
||||
test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
|
||||
test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
|
||||
test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 5, SV(""), S(""));
|
||||
test(S("abcde"), 0, 5, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 0, 6, SV(""), S(""));
|
||||
test(S("abcde"), 0, 6, SV("12345"), S("12345"));
|
||||
test(S("abcde"), 0, 6, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcde"), 0, 6, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcde"), 1, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
|
||||
test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
|
||||
test(S("abcde"), 1, 1, SV(""), S("acde"));
|
||||
test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
|
||||
test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
|
||||
test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
|
||||
test(S("abcde"), 1, 2, SV(""), S("ade"));
|
||||
test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
|
||||
test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
|
||||
test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
|
||||
test(S("abcde"), 1, 3, SV(""), S("ae"));
|
||||
test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
|
||||
test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
|
||||
test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
|
||||
test(S("abcde"), 1, 4, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 1, 5, SV(""), S("a"));
|
||||
test(S("abcde"), 1, 5, SV("12345"), S("a12345"));
|
||||
test(S("abcde"), 1, 5, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcde"), 1, 5, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcde"), 2, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
|
||||
test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, 1, SV(""), S("abde"));
|
||||
test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
|
||||
test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
|
||||
test(S("abcde"), 2, 2, SV(""), S("abe"));
|
||||
test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
|
||||
test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
|
||||
test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
|
||||
test(S("abcde"), 2, 3, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 2, 4, SV(""), S("ab"));
|
||||
test(S("abcde"), 2, 4, SV("12345"), S("ab12345"));
|
||||
test(S("abcde"), 2, 4, SV("1234567890"), S("ab1234567890"));
|
||||
test(S("abcde"), 2, 4, SV("12345678901234567890"), S("ab12345678901234567890"));
|
||||
test(S("abcde"), 4, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
|
||||
test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
|
||||
test(S("abcde"), 4, 1, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 4, 2, SV(""), S("abcd"));
|
||||
test(S("abcde"), 4, 2, SV("12345"), S("abcd12345"));
|
||||
test(S("abcde"), 4, 2, SV("1234567890"), S("abcd1234567890"));
|
||||
test(S("abcde"), 4, 2, SV("12345678901234567890"), S("abcd12345678901234567890"));
|
||||
test(S("abcde"), 5, 0, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, 1, SV(""), S("abcde"));
|
||||
test(S("abcde"), 5, 1, SV("12345"), S("abcde12345"));
|
||||
test(S("abcde"), 5, 1, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, SV(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, SV(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 11, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 10, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, SV(""), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test1() {
|
||||
test(S("abcde"), 6, 0, SV(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 0, 9, SV(""), S("j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 10, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 0, 11, SV(""), S(""));
|
||||
test(S("abcdefghij"), 0, 11, SV("12345"), S("12345"));
|
||||
test(S("abcdefghij"), 0, 11, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
|
||||
test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
|
||||
test(S("abcdefghij"), 1, 9, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, SV(""), S("a"));
|
||||
test(S("abcdefghij"), 1, 10, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
|
||||
test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
|
||||
test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
|
||||
test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 5, 6, SV(""), S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, SV("12345"), S("abcde12345"));
|
||||
test(S("abcdefghij"), 5, 6, SV("1234567890"), S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
|
||||
test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
|
||||
test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 9, 2, SV(""), S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 2, SV("12345"), S("abcdefghi12345"));
|
||||
test(S("abcdefghij"), 9, 2, SV("1234567890"), S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 10, 1, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghij"), 10, 1, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghij"), 11, 0, SV(""), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
TEST_CONSTEXPR_CXX20 bool test2() {
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), S("12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), S("a"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), S("a12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), S("a1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), S("a12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), S("abcdefghij12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), S("abcdefghij1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), S("abcdefghijklmnopqrs12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), S("abcdefghijklmnopqrst12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -383,8 +373,7 @@ void test() {
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
|
||||
@@ -19,16 +19,14 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s1, S s2)
|
||||
{
|
||||
S s1_ = s1;
|
||||
S s2_ = s2;
|
||||
s1.swap(s2);
|
||||
LIBCPP_ASSERT(s1.__invariants());
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s1 == s2_);
|
||||
assert(s2 == s1_);
|
||||
TEST_CONSTEXPR_CXX20 void test(S s1, S s2) {
|
||||
S s1_ = s1;
|
||||
S s2_ = s2;
|
||||
s1.swap(s2);
|
||||
LIBCPP_ASSERT(s1.__invariants());
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s1 == s2_);
|
||||
assert(s2 == s1_);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
@@ -60,8 +58,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
Reference in New Issue
Block a user