[libc++] Prepare string.modifiers tests for constexpr
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D119329
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Incomplete;
|
||||
template<class T> struct Holder { T t; };
|
||||
|
||||
@@ -21,15 +23,24 @@ struct Charlike {
|
||||
operator char() const { return ch_; }
|
||||
};
|
||||
|
||||
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);
|
||||
assert(s == "mahimahi");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
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);
|
||||
assert(s == "mahimahi");
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
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())
|
||||
@@ -46,7 +46,7 @@ test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, SV sv, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= sv.size())
|
||||
@@ -71,9 +71,8 @@ test_npos(S s, SV sv, typename S::size_type pos, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test(S(), SV(), 0, 0, S());
|
||||
@@ -97,9 +96,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
|
||||
S("123456789012345678906789012345"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::basic_string_view<char, std::char_traits<char> > SV;
|
||||
test(S(), SV(), 0, 0, S());
|
||||
@@ -123,9 +122,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
|
||||
S("123456789012345678906789012345"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test_npos(S(), SV(), 0, S());
|
||||
@@ -135,9 +134,9 @@ int main(int, char**)
|
||||
test_npos(S(), SV("12345"), 3, S("45"));
|
||||
test_npos(S(), SV("12345"), 5, S(""));
|
||||
test_npos(S(), SV("12345"), 6, S("not happening"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s;
|
||||
std::string_view sv = "EFGH";
|
||||
char arr[] = "IJKL";
|
||||
@@ -169,9 +168,9 @@ int main(int, char**)
|
||||
s.append(arr, 0); // calls append(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = s;
|
||||
s.append(sv);
|
||||
@@ -184,9 +183,9 @@ int main(int, char**)
|
||||
sv = s;
|
||||
s.append(sv, sv.size());
|
||||
assert(s == "ABCDABCDABCDABCD");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string_view sv = s;
|
||||
s.append(sv);
|
||||
@@ -195,7 +194,17 @@ int main(int, char**)
|
||||
sv = s;
|
||||
s.append(sv, 0, std::string::npos);
|
||||
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,19 +18,28 @@
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
bool test() {
|
||||
{
|
||||
std::string s("123");
|
||||
s.append({'a', 'b', 'c'});
|
||||
assert(s == "123abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s.append({'a', 'b', 'c'});
|
||||
assert(s == "123abc");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::string s("123");
|
||||
s.append({'a', 'b', 'c'});
|
||||
assert(s == "123abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s.append({'a', 'b', 'c'});
|
||||
assert(s == "123abc");
|
||||
}
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, It first, It last, S expected)
|
||||
{
|
||||
s.append(first, last);
|
||||
@@ -31,7 +31,7 @@ test(S s, It first, It last, S expected)
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_exceptions(S s, It first, It last)
|
||||
{
|
||||
S original = s;
|
||||
@@ -52,9 +52,8 @@ test_exceptions(S s, It first, It last)
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
@@ -111,9 +110,9 @@ int main(int, char**)
|
||||
S("12345678901234567890""ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
@@ -170,10 +169,10 @@ int main(int, char**)
|
||||
S("12345678901234567890""ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{ // test iterator operations that throw
|
||||
{ // test iterator operations that throw
|
||||
typedef std::string S;
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
@@ -188,10 +187,10 @@ int main(int, char**)
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), w, w+100);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test appending to self
|
||||
{ // test appending to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -205,18 +204,18 @@ int main(int, char**)
|
||||
|
||||
s_long.append(s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
{ // test appending a different type
|
||||
{ // test appending a different type
|
||||
typedef std::string S;
|
||||
const uint8_t p[] = "ABCD";
|
||||
|
||||
S s;
|
||||
s.append(p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
{ // regression-test appending to self in sneaky ways
|
||||
{ // 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_othertype = "hello";
|
||||
@@ -231,7 +230,7 @@ int main(int, char**)
|
||||
|
||||
s_sneaky.reserve(12);
|
||||
test(s_sneaky, s_sneaky.data(), s_sneaky.data() + 6, std::string("hellohello\0", 11));
|
||||
}
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef forward_iterator<const char*> It;
|
||||
@@ -250,5 +249,15 @@ int main(int, char**)
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@ test(S s, const typename S::value_type* str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -42,9 +41,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -58,10 +57,10 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test appending to self
|
||||
{ // test appending to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -75,7 +74,17 @@ int main(int, char**)
|
||||
|
||||
s_long.append(s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
|
||||
{
|
||||
s.append(str, n);
|
||||
@@ -27,9 +27,8 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", 0, S());
|
||||
test(S(), "12345", 3, S("123"));
|
||||
@@ -47,9 +46,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20,
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", 0, S());
|
||||
test(S(), "12345", 3, S("123"));
|
||||
@@ -67,10 +66,10 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20,
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test appending to self
|
||||
{ // test appending to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -84,7 +83,17 @@ int main(int, char**)
|
||||
|
||||
s_long.append(s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ struct veryLarge
|
||||
};
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::value_type c, S expected)
|
||||
{
|
||||
s.push_back(c);
|
||||
@@ -31,31 +31,40 @@ test(S s, typename S::value_type c, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), 'a', S(1, 'a'));
|
||||
test(S("12345"), 'a', S("12345a"));
|
||||
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), 'a', S(1, 'a'));
|
||||
test(S("12345"), 'a', S("12345a"));
|
||||
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
{
|
||||
// https://llvm.org/PR31454
|
||||
std::basic_string<veryLarge> s;
|
||||
veryLarge vl = {};
|
||||
s.push_back(vl);
|
||||
s.push_back(vl);
|
||||
s.push_back(vl);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
{
|
||||
s.append(n, c);
|
||||
@@ -26,9 +26,8 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), 0, 'a', S());
|
||||
test(S(), 1, 'a', S(1, 'a'));
|
||||
@@ -42,9 +41,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), 0, 'a', S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a"));
|
||||
test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), 0, 'a', S());
|
||||
test(S(), 1, 'a', S(1, 'a'));
|
||||
@@ -58,7 +57,17 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), 0, 'a', S("12345678901234567890"));
|
||||
test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a"));
|
||||
test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.append(str);
|
||||
@@ -26,9 +26,8 @@ test(S s, S str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -50,9 +49,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -74,16 +73,26 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s.append({"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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())
|
||||
@@ -46,7 +46,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
@@ -71,9 +71,8 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), 0, 0, S());
|
||||
test(S(), S(), 1, 0, S());
|
||||
@@ -96,9 +95,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10,
|
||||
S("123456789012345678906789012345"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), 0, 0, S());
|
||||
test(S(), S(), 1, 0, S());
|
||||
@@ -121,9 +120,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10,
|
||||
S("123456789012345678906789012345"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test_npos(S(), S(), 0, S());
|
||||
test_npos(S(), S(), 1, S());
|
||||
@@ -132,7 +131,17 @@ int main(int, char**)
|
||||
test_npos(S(), S("12345"), 3, S("45"));
|
||||
test_npos(S(), S("12345"), 5, S(""));
|
||||
test_npos(S(), S("12345"), 6, S("not happening"));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, S expected)
|
||||
{
|
||||
s.append(sv);
|
||||
@@ -27,9 +27,8 @@ test(S s, SV sv, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test(S(), SV(), S());
|
||||
@@ -52,9 +51,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::basic_string_view<char, std::char_traits<char> > SV;
|
||||
test(S(), SV(), S());
|
||||
@@ -77,7 +76,17 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -70,9 +70,8 @@ test_npos(S s, SV sv, typename S::size_type pos, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test(S(), SV(), 0, 0, S());
|
||||
@@ -96,9 +95,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::basic_string_view<char, std::char_traits<char> > SV;
|
||||
test(S(), SV(), 0, 0, S());
|
||||
@@ -122,9 +121,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test_npos(S(), SV(), 0, S());
|
||||
@@ -134,9 +133,9 @@ int main(int, char**)
|
||||
test_npos(S(), SV("12345"), 3, S("45"));
|
||||
test_npos(S(), SV("12345"), 5, S(""));
|
||||
test_npos(S(), SV("12345"), 6, S("not happening"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = "EFGH";
|
||||
char arr[] = "IJKL";
|
||||
@@ -168,9 +167,9 @@ int main(int, char**)
|
||||
s.assign(arr, 0); // calls assign(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s = "ABCD";
|
||||
std::string_view sv = s;
|
||||
s.assign(sv);
|
||||
@@ -179,9 +178,9 @@ int main(int, char**)
|
||||
sv = s;
|
||||
s.assign(sv, 0, std::string::npos);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::string_view sv = s;
|
||||
s.assign(sv);
|
||||
@@ -190,7 +189,17 @@ int main(int, char**)
|
||||
sv = s;
|
||||
s.assign(sv, 0, std::string::npos);
|
||||
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,19 +18,28 @@
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
bool test() {
|
||||
{
|
||||
std::string s("123");
|
||||
s.assign({'a', 'b', 'c'});
|
||||
assert(s == "abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s.assign({'a', 'b', 'c'});
|
||||
assert(s == "abc");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::string s("123");
|
||||
s.assign({'a', 'b', 'c'});
|
||||
assert(s == "abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s.assign({'a', 'b', 'c'});
|
||||
assert(s == "abc");
|
||||
}
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -52,9 +52,8 @@ test_exceptions(S s, It first, It last)
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
@@ -111,9 +110,9 @@ int main(int, char**)
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), s, s, S());
|
||||
@@ -170,10 +169,10 @@ int main(int, char**)
|
||||
S("ABCDEFGHIJ"));
|
||||
test(S("12345678901234567890"), cpp17_input_iterator<const char*>(s), cpp17_input_iterator<const char*>(s+52),
|
||||
S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{ // test iterator operations that throw
|
||||
{ // test iterator operations that throw
|
||||
typedef std::string S;
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
@@ -188,10 +187,10 @@ int main(int, char**)
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), w, w+100);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test assigning to self
|
||||
{ // test assigning to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -206,23 +205,33 @@ int main(int, char**)
|
||||
|
||||
s_long.assign(s_long.begin() + 30, s_long.end());
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
{ // test assigning a different type
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
const uint8_t p[] = "ABCD";
|
||||
|
||||
S s;
|
||||
s.assign(p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
{ // regression-test assigning to self in sneaky ways
|
||||
{ // regression-test assigning to self in sneaky ways
|
||||
std::string sneaky = "hello";
|
||||
sneaky.resize(sneaky.capacity(), 'x');
|
||||
std::string expected = sneaky + std::string(1, '\0');
|
||||
test(sneaky, sneaky.data(), sneaky.data() + sneaky.size() + 1, expected);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, S expected)
|
||||
{
|
||||
s.assign(str);
|
||||
@@ -26,9 +26,8 @@ test(S s, const typename S::value_type* str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -42,9 +41,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("12345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -58,10 +57,10 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("12345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test assignment to self
|
||||
{ // test assignment to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -73,7 +72,17 @@ int main(int, char**)
|
||||
|
||||
s_long.assign(s_long.c_str() + 30);
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, typename S::size_type n, S expected)
|
||||
{
|
||||
s.assign(str, n);
|
||||
@@ -27,9 +27,8 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", 0, S());
|
||||
test(S(), "12345", 3, S("123"));
|
||||
@@ -47,9 +46,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", 5, S("12345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20,
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", 0, S());
|
||||
test(S(), "12345", 3, S("123"));
|
||||
@@ -67,9 +66,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", 5, S("12345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890", 20,
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{ // test assign to self
|
||||
{ // test assign to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -84,7 +83,17 @@ int main(int, char**)
|
||||
|
||||
s_long.assign(s_long.data() + 2, 8 );
|
||||
assert(s_long == "rem ipsu");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.assign(std::move(str));
|
||||
@@ -27,9 +27,8 @@ test(S s, S str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -51,9 +50,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -75,7 +74,17 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("1234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
{
|
||||
s.assign(n, c);
|
||||
@@ -26,9 +26,8 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), 0, 'a', S());
|
||||
test(S(), 1, 'a', S(1, 'a'));
|
||||
@@ -42,9 +41,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), 0, 'a', S());
|
||||
test(S("12345678901234567890"), 1, 'a', S(1, 'a'));
|
||||
test(S("12345678901234567890"), 10, 'a', S(10, 'a'));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), 0, 'a', S());
|
||||
test(S(), 1, 'a', S(1, 'a'));
|
||||
@@ -58,7 +57,17 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), 0, 'a', S());
|
||||
test(S("12345678901234567890"), 1, 'a', S(1, 'a'));
|
||||
test(S("12345678901234567890"), 10, 'a', S(10, 'a'));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.assign(str);
|
||||
@@ -28,7 +28,7 @@ test(S s, S str, S expected)
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
testAlloc(S s, S str, const typename S::allocator_type& a)
|
||||
{
|
||||
s.assign(str);
|
||||
@@ -37,9 +37,8 @@ testAlloc(S s, S str, const typename S::allocator_type& a)
|
||||
assert(s.get_allocator() == a);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -66,19 +65,19 @@ int main(int, 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
|
||||
{ // 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
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -105,13 +104,23 @@ int main(int, char**)
|
||||
testAlloc(S(), S("12345"), min_allocator<char>());
|
||||
testAlloc(S(), S("1234567890"), min_allocator<char>());
|
||||
testAlloc(S(), S("12345678901234567890"), min_allocator<char>());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if TEST_STD_VER > 14
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
static_assert(noexcept(S().assign(S())), ""); // LWG#2063
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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())
|
||||
@@ -46,7 +46,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
{
|
||||
if (pos <= str.size())
|
||||
@@ -71,9 +71,8 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), 0, 0, S());
|
||||
test(S(), S(), 1, 0, S());
|
||||
@@ -96,9 +95,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), 0, 0, S());
|
||||
test(S(), S(), 1, 0, S());
|
||||
@@ -121,9 +120,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("12345"), 1, 3, S("234"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"), 5, 10,
|
||||
S("6789012345"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test_npos(S(), S(), 0, S());
|
||||
test_npos(S(), S(), 1, S());
|
||||
@@ -132,7 +131,17 @@ int main(int, char**)
|
||||
test_npos(S(), S("12345"), 3, S("45"));
|
||||
test_npos(S(), S("12345"), 5, S(""));
|
||||
test_npos(S(), S("12345"), 6, S("not happening"));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, SV sv, S expected)
|
||||
{
|
||||
s.assign(sv);
|
||||
@@ -29,7 +29,7 @@ test(S s, SV sv, S expected)
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
testAlloc(S s, SV sv, const typename S::allocator_type& a)
|
||||
{
|
||||
s.assign(sv);
|
||||
@@ -38,9 +38,8 @@ testAlloc(S s, SV sv, const typename S::allocator_type& a)
|
||||
assert(s.get_allocator() == a);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test(S(), SV(), S());
|
||||
@@ -68,10 +67,10 @@ int main(int, char**)
|
||||
testAlloc(S(), SV("12345"), std::allocator<char>());
|
||||
testAlloc(S(), SV("1234567890"), std::allocator<char>());
|
||||
testAlloc(S(), SV("12345678901234567890"), std::allocator<char>());
|
||||
}
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::basic_string_view<char, std::char_traits<char> > SV;
|
||||
test(S(), SV(), S());
|
||||
@@ -99,7 +98,17 @@ int main(int, char**)
|
||||
testAlloc(S(), SV("12345"), min_allocator<char>());
|
||||
testAlloc(S(), SV("1234567890"), min_allocator<char>());
|
||||
testAlloc(S(), SV("12345678901234567890"), min_allocator<char>());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -49,9 +49,8 @@ test(S str, typename S::value_type* s, typename S::size_type n,
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
char s[50];
|
||||
test(S(""), s, 0, 0);
|
||||
@@ -112,9 +111,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), s, 20, 0);
|
||||
test(S("abcdefghijklmnopqrst"), s, 20, 1);
|
||||
test(S("abcdefghijklmnopqrst"), s, 21, 0);
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
char s[50];
|
||||
test(S(""), s, 0, 0);
|
||||
@@ -175,7 +174,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), s, 20, 0);
|
||||
test(S("abcdefghijklmnopqrst"), s, 20, 1);
|
||||
test(S("abcdefghijklmnopqrst"), s, 21, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, S expected)
|
||||
{
|
||||
typename S::const_iterator p = s.begin() + pos;
|
||||
@@ -28,9 +28,8 @@ test(S s, typename S::difference_type pos, S expected)
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S("abcde"), 0, S("bcde"));
|
||||
test(S("abcde"), 1, S("acde"));
|
||||
@@ -44,9 +43,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S("abcde"), 0, S("bcde"));
|
||||
test(S("abcde"), 1, S("acde"));
|
||||
@@ -60,7 +59,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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;
|
||||
@@ -29,9 +29,8 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, 0, S(""));
|
||||
test(S("abcde"), 0, 0, S("abcde"));
|
||||
@@ -87,9 +86,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, 0, S(""));
|
||||
test(S("abcde"), 0, 0, S("abcde"));
|
||||
@@ -145,7 +144,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S expected)
|
||||
{
|
||||
s.pop_back();
|
||||
@@ -26,21 +26,30 @@ test(S s, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S("abcde"), S("abcd"));
|
||||
test(S("abcdefghij"), S("abcdefghi"));
|
||||
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S("abcde"), S("abcd"));
|
||||
test(S("abcdefghij"), S("abcdefghi"));
|
||||
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -49,7 +49,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
@@ -79,7 +79,7 @@ test(S s, typename S::size_type pos, S expected)
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S expected)
|
||||
{
|
||||
s.erase();
|
||||
@@ -88,9 +88,8 @@ test(S s, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, 0, S(""));
|
||||
test(S(""), 0, 1, S(""));
|
||||
@@ -192,9 +191,9 @@ int main(int, char**)
|
||||
test(S("abcde"), S(""));
|
||||
test(S("abcdefghij"), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), S(""));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, 0, S(""));
|
||||
test(S(""), 0, 1, S(""));
|
||||
@@ -296,7 +295,17 @@ int main(int, char**)
|
||||
test(S("abcde"), S(""));
|
||||
test(S("abcdefghij"), S(""));
|
||||
test(S("abcdefghijklmnopqrst"), S(""));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -32,9 +32,8 @@ test(S& s, typename S::const_iterator p, typename S::value_type c, S expected)
|
||||
assert(i == p);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
S s;
|
||||
test(s, s.begin(), '1', S("1"));
|
||||
@@ -51,9 +50,9 @@ int main(int, char**)
|
||||
test(s, s.begin()+4, 'A', S("a567A1432dcb"));
|
||||
test(s, s.begin()+5, 'B', S("a567AB1432dcb"));
|
||||
test(s, s.begin()+6, 'C', S("a567ABC1432dcb"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s;
|
||||
test(s, s.begin(), '1', S("1"));
|
||||
@@ -70,7 +69,17 @@ int main(int, char**)
|
||||
test(s, s.begin()+4, 'A', S("a567A1432dcb"));
|
||||
test(s, s.begin()+5, 'B', S("a567AB1432dcb"));
|
||||
test(s, s.begin()+6, 'C', S("a567ABC1432dcb"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,21 +19,30 @@
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
bool test() {
|
||||
{
|
||||
std::string s("123456");
|
||||
std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
|
||||
assert(i - s.begin() == 3);
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123456");
|
||||
S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
|
||||
assert(i - s.begin() == 3);
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::string s("123456");
|
||||
std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
|
||||
assert(i - s.begin() == 3);
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123456");
|
||||
S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
|
||||
assert(i - s.begin() == 3);
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
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;
|
||||
@@ -33,7 +33,7 @@ test(S s, typename S::difference_type pos, It first, It last, S expected)
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
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;
|
||||
@@ -56,9 +56,8 @@ test_exceptions(S s, typename S::difference_type pos, It first, It last)
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), 0, s, s, S());
|
||||
@@ -102,9 +101,9 @@ int main(int, char**)
|
||||
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"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
test(S(), 0, s, s, S());
|
||||
@@ -148,10 +147,10 @@ int main(int, char**)
|
||||
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"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{ // test iterator operations that throw
|
||||
{ // test iterator operations that throw
|
||||
typedef std::string S;
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
@@ -166,10 +165,10 @@ int main(int, char**)
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S(), 0, w, w+100);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test inserting into self
|
||||
{ // test inserting into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -183,18 +182,18 @@ int main(int, char**)
|
||||
|
||||
s_long.insert(s_long.begin(), s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
{ // test assigning a different type
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
const uint8_t p[] = "ABCD";
|
||||
|
||||
S s;
|
||||
s.insert(s.begin(), p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
{ // regression-test inserting into self in sneaky ways
|
||||
{ // 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";
|
||||
@@ -205,7 +204,7 @@ int main(int, char**)
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef cpp17_input_iterator<const char*> It;
|
||||
@@ -232,5 +231,15 @@ int main(int, char**)
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::difference_type pos, typename S::size_type n,
|
||||
typename S::value_type c, S expected)
|
||||
{
|
||||
@@ -28,9 +28,8 @@ test(S s, typename S::difference_type pos, typename S::size_type n,
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, 0, '1', S(""));
|
||||
test(S(""), 0, 5, '1', S("11111"));
|
||||
@@ -96,9 +95,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, 0, '1', S(""));
|
||||
test(S(""), 0, 5, '1', S("11111"));
|
||||
@@ -164,7 +163,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2,
|
||||
typename S::size_type n, S expected)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ test(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2,
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, S expected)
|
||||
{
|
||||
static_assert((!std::is_same<S, SV>::value), "");
|
||||
@@ -83,7 +83,7 @@ test_npos(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, S
|
||||
|
||||
|
||||
template <class S, class SV>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, SV(""), 0, 0, S(""));
|
||||
test(S(""), 0, SV(""), 0, 1, S(""));
|
||||
@@ -135,10 +135,12 @@ void test0()
|
||||
test(S(""), 0, SV("1234567890"), 10, 0, S(""));
|
||||
test(S(""), 0, SV("1234567890"), 10, 1, S(""));
|
||||
test(S(""), 0, SV("1234567890"), 11, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S(""), 0, SV("12345678901234567890"), 0, 0, S(""));
|
||||
test(S(""), 0, SV("12345678901234567890"), 0, 1, S("1"));
|
||||
@@ -190,10 +192,12 @@ void test1()
|
||||
test(S(""), 1, SV("12345"), 5, 0, S("can't happen"));
|
||||
test(S(""), 1, SV("12345"), 5, 1, S("can't happen"));
|
||||
test(S(""), 1, SV("12345"), 6, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S(""), 1, SV("1234567890"), 0, 0, S("can't happen"));
|
||||
test(S(""), 1, SV("1234567890"), 0, 1, S("can't happen"));
|
||||
@@ -245,10 +249,12 @@ void test2()
|
||||
test(S(""), 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, SV(""), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 0, SV(""), 0, 1, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcde"), 0, SV(""), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, SV("12345"), 0, 0, S("abcde"));
|
||||
@@ -300,10 +306,12 @@ void test3()
|
||||
test(S("abcde"), 0, SV("1234567890"), 11, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, SV("12345678901234567890"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 0, SV("12345678901234567890"), 0, 1, S("1abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcde"), 0, SV("12345678901234567890"), 0, 10, S("1234567890abcde"));
|
||||
test(S("abcde"), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
|
||||
@@ -355,10 +363,12 @@ void test4()
|
||||
test(S("abcde"), 1, SV("12345"), 6, 0, S("can't happen"));
|
||||
test(S("abcde"), 1, SV("1234567890"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 1, SV("1234567890"), 0, 1, S("a1bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcde"), 1, SV("1234567890"), 0, 5, S("a12345bcde"));
|
||||
test(S("abcde"), 1, SV("1234567890"), 0, 9, S("a123456789bcde"));
|
||||
@@ -410,10 +420,12 @@ void test5()
|
||||
test(S("abcde"), 2, SV(""), 0, 1, S("abcde"));
|
||||
test(S("abcde"), 2, SV(""), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 2, SV("12345"), 0, 0, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcde"), 2, SV("12345"), 0, 1, S("ab1cde"));
|
||||
test(S("abcde"), 2, SV("12345"), 0, 2, S("ab12cde"));
|
||||
@@ -465,10 +477,12 @@ void test6()
|
||||
test(S("abcde"), 2, SV("12345678901234567890"), 0, 1, S("ab1cde"));
|
||||
test(S("abcde"), 2, SV("12345678901234567890"), 0, 10, S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcde"), 2, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
|
||||
@@ -520,10 +534,12 @@ void test7()
|
||||
test(S("abcde"), 4, SV("1234567890"), 0, 1, S("abcd1e"));
|
||||
test(S("abcde"), 4, SV("1234567890"), 0, 5, S("abcd12345e"));
|
||||
test(S("abcde"), 4, SV("1234567890"), 0, 9, S("abcd123456789e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcde"), 4, SV("1234567890"), 0, 10, S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, SV("1234567890"), 0, 11, S("abcd1234567890e"));
|
||||
@@ -575,10 +591,12 @@ void test8()
|
||||
test(S("abcde"), 5, SV("12345"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 5, SV("12345"), 0, 1, S("abcde1"));
|
||||
test(S("abcde"), 5, SV("12345"), 0, 2, S("abcde12"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test9()
|
||||
TEST_CONSTEXPR_CXX20 bool test9()
|
||||
{
|
||||
test(S("abcde"), 5, SV("12345"), 0, 4, S("abcde1234"));
|
||||
test(S("abcde"), 5, SV("12345"), 0, 5, S("abcde12345"));
|
||||
@@ -630,10 +648,12 @@ void test9()
|
||||
test(S("abcde"), 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
|
||||
test(S("abcde"), 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test10()
|
||||
TEST_CONSTEXPR_CXX20 bool test10()
|
||||
{
|
||||
test(S("abcde"), 5, SV("12345678901234567890"), 1, 0, S("abcde"));
|
||||
test(S("abcde"), 5, SV("12345678901234567890"), 1, 1, S("abcde2"));
|
||||
@@ -685,10 +705,12 @@ void test10()
|
||||
test(S("abcde"), 6, SV("1234567890"), 0, 9, S("can't happen"));
|
||||
test(S("abcde"), 6, SV("1234567890"), 0, 10, S("can't happen"));
|
||||
test(S("abcde"), 6, SV("1234567890"), 0, 11, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test11()
|
||||
TEST_CONSTEXPR_CXX20 bool test11()
|
||||
{
|
||||
test(S("abcde"), 6, SV("1234567890"), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 6, SV("1234567890"), 1, 1, S("can't happen"));
|
||||
@@ -740,10 +762,12 @@ void test11()
|
||||
test(S("abcdefghij"), 0, SV("12345"), 0, 2, S("12abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345"), 0, 4, S("1234abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345"), 0, 5, S("12345abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test12()
|
||||
TEST_CONSTEXPR_CXX20 bool test12()
|
||||
{
|
||||
test(S("abcdefghij"), 0, SV("12345"), 0, 6, S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345"), 1, 0, S("abcdefghij"));
|
||||
@@ -795,10 +819,12 @@ void test12()
|
||||
test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 1, S("2abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test13()
|
||||
TEST_CONSTEXPR_CXX20 bool test13()
|
||||
{
|
||||
test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
|
||||
@@ -850,10 +876,12 @@ void test13()
|
||||
test(S("abcdefghij"), 1, SV("1234567890"), 0, 11, S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, SV("1234567890"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, SV("1234567890"), 1, 1, S("a2bcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test14()
|
||||
TEST_CONSTEXPR_CXX20 bool test14()
|
||||
{
|
||||
test(S("abcdefghij"), 1, SV("1234567890"), 1, 4, S("a2345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, SV("1234567890"), 1, 8, S("a23456789bcdefghij"));
|
||||
@@ -905,10 +933,12 @@ void test14()
|
||||
test(S("abcdefghij"), 5, SV("12345"), 0, 5, S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345"), 0, 6, S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345"), 1, 0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test15()
|
||||
TEST_CONSTEXPR_CXX20 bool test15()
|
||||
{
|
||||
test(S("abcdefghij"), 5, SV("12345"), 1, 1, S("abcde2fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345"), 1, 2, S("abcde23fghij"));
|
||||
@@ -960,10 +990,12 @@ void test15()
|
||||
test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 1, S("abcde2fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test16()
|
||||
TEST_CONSTEXPR_CXX20 bool test16()
|
||||
{
|
||||
test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
|
||||
@@ -1015,10 +1047,12 @@ void test16()
|
||||
test(S("abcdefghij"), 9, SV("1234567890"), 1, 1, S("abcdefghi2j"));
|
||||
test(S("abcdefghij"), 9, SV("1234567890"), 1, 4, S("abcdefghi2345j"));
|
||||
test(S("abcdefghij"), 9, SV("1234567890"), 1, 8, S("abcdefghi23456789j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test17()
|
||||
TEST_CONSTEXPR_CXX20 bool test17()
|
||||
{
|
||||
test(S("abcdefghij"), 9, SV("1234567890"), 1, 9, S("abcdefghi234567890j"));
|
||||
test(S("abcdefghij"), 9, SV("1234567890"), 1, 10, S("abcdefghi234567890j"));
|
||||
@@ -1070,10 +1104,12 @@ void test17()
|
||||
test(S("abcdefghij"), 10, SV("12345"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, SV("12345"), 1, 1, S("abcdefghij2"));
|
||||
test(S("abcdefghij"), 10, SV("12345"), 1, 2, S("abcdefghij23"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test18()
|
||||
TEST_CONSTEXPR_CXX20 bool test18()
|
||||
{
|
||||
test(S("abcdefghij"), 10, SV("12345"), 1, 3, S("abcdefghij234"));
|
||||
test(S("abcdefghij"), 10, SV("12345"), 1, 4, S("abcdefghij2345"));
|
||||
@@ -1125,10 +1161,12 @@ void test18()
|
||||
test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
|
||||
test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
|
||||
test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test19()
|
||||
TEST_CONSTEXPR_CXX20 bool test19()
|
||||
{
|
||||
test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
|
||||
@@ -1180,10 +1218,12 @@ void test19()
|
||||
test(S("abcdefghij"), 11, SV("1234567890"), 1, 8, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, SV("1234567890"), 1, 9, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, SV("1234567890"), 1, 10, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test20()
|
||||
TEST_CONSTEXPR_CXX20 bool test20()
|
||||
{
|
||||
test(S("abcdefghij"), 11, SV("1234567890"), 5, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, SV("1234567890"), 5, 1, S("can't happen"));
|
||||
@@ -1235,10 +1275,12 @@ void test20()
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test21()
|
||||
TEST_CONSTEXPR_CXX20 bool test21()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
@@ -1290,10 +1332,12 @@ void test21()
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test22()
|
||||
TEST_CONSTEXPR_CXX20 bool test22()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
|
||||
@@ -1345,10 +1389,12 @@ void test22()
|
||||
test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test23()
|
||||
TEST_CONSTEXPR_CXX20 bool test23()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
|
||||
@@ -1400,10 +1446,12 @@ void test23()
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test24()
|
||||
TEST_CONSTEXPR_CXX20 bool test24()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
|
||||
@@ -1455,10 +1503,12 @@ void test24()
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test25()
|
||||
TEST_CONSTEXPR_CXX20 bool test25()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
|
||||
@@ -1510,10 +1560,12 @@ void test25()
|
||||
test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test26()
|
||||
TEST_CONSTEXPR_CXX20 bool test26()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
|
||||
@@ -1565,10 +1617,12 @@ void test26()
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test27()
|
||||
TEST_CONSTEXPR_CXX20 bool test27()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
|
||||
@@ -1620,10 +1674,12 @@ void test27()
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test28()
|
||||
TEST_CONSTEXPR_CXX20 bool test28()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
|
||||
@@ -1675,10 +1731,12 @@ void test28()
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 4, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 5, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 6, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test29()
|
||||
TEST_CONSTEXPR_CXX20 bool test29()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 1, S("can't happen"));
|
||||
@@ -1710,10 +1768,12 @@ void test29()
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 1, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test30()
|
||||
TEST_CONSTEXPR_CXX20 bool test30()
|
||||
{
|
||||
test_npos(S(""), 0, SV("12345678901234567890"), 0, S("12345678901234567890"));
|
||||
test_npos(S(""), 0, SV("12345678901234567890"), 1, S( "2345678901234567890"));
|
||||
@@ -1727,85 +1787,12 @@ void test30()
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 3, S("abcdefghij45klmnopqrst"));
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 5, S("abcdefghijklmnopqrst"));
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 6, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
test3<S, SV>();
|
||||
test4<S, SV>();
|
||||
test5<S, SV>();
|
||||
test6<S, SV>();
|
||||
test7<S, SV>();
|
||||
test8<S, SV>();
|
||||
test9<S, SV>();
|
||||
test10<S, SV>();
|
||||
test11<S, SV>();
|
||||
test12<S, SV>();
|
||||
test13<S, SV>();
|
||||
test14<S, SV>();
|
||||
test15<S, SV>();
|
||||
test16<S, SV>();
|
||||
test17<S, SV>();
|
||||
test18<S, SV>();
|
||||
test19<S, SV>();
|
||||
test20<S, SV>();
|
||||
test21<S, SV>();
|
||||
test22<S, SV>();
|
||||
test23<S, SV>();
|
||||
test24<S, SV>();
|
||||
test25<S, SV>();
|
||||
test26<S, SV>();
|
||||
test27<S, SV>();
|
||||
test28<S, SV>();
|
||||
test29<S, SV>();
|
||||
test30<S, SV>();
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::basic_string_view<char, std::char_traits<char>> SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
test3<S, SV>();
|
||||
test4<S, SV>();
|
||||
test5<S, SV>();
|
||||
test6<S, SV>();
|
||||
test7<S, SV>();
|
||||
test8<S, SV>();
|
||||
test9<S, SV>();
|
||||
test10<S, SV>();
|
||||
test11<S, SV>();
|
||||
test12<S, SV>();
|
||||
test13<S, SV>();
|
||||
test14<S, SV>();
|
||||
test15<S, SV>();
|
||||
test16<S, SV>();
|
||||
test17<S, SV>();
|
||||
test18<S, SV>();
|
||||
test19<S, SV>();
|
||||
test20<S, SV>();
|
||||
test21<S, SV>();
|
||||
test22<S, SV>();
|
||||
test23<S, SV>();
|
||||
test24<S, SV>();
|
||||
test25<S, SV>();
|
||||
test26<S, SV>();
|
||||
test27<S, SV>();
|
||||
test28<S, SV>();
|
||||
test29<S, SV>();
|
||||
test30<S, SV>();
|
||||
}
|
||||
#endif
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
template <class S, class SV>
|
||||
bool test31() {
|
||||
S s;
|
||||
SV sv = "EFGH";
|
||||
char arr[] = "IJKL";
|
||||
@@ -1837,7 +1824,88 @@ int main(int, char**)
|
||||
s.insert(0, arr, 0); // calls insert(const char *, len)
|
||||
assert(s == "");
|
||||
s.clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test() {
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
test3<S, SV>();
|
||||
test4<S, SV>();
|
||||
test5<S, SV>();
|
||||
test6<S, SV>();
|
||||
test7<S, SV>();
|
||||
test8<S, SV>();
|
||||
test9<S, SV>();
|
||||
test10<S, SV>();
|
||||
test11<S, SV>();
|
||||
test12<S, SV>();
|
||||
test13<S, SV>();
|
||||
test14<S, SV>();
|
||||
test15<S, SV>();
|
||||
test16<S, SV>();
|
||||
test17<S, SV>();
|
||||
test18<S, SV>();
|
||||
test19<S, SV>();
|
||||
test20<S, SV>();
|
||||
test21<S, SV>();
|
||||
test22<S, SV>();
|
||||
test23<S, SV>();
|
||||
test24<S, SV>();
|
||||
test25<S, SV>();
|
||||
test26<S, SV>();
|
||||
test27<S, SV>();
|
||||
test28<S, SV>();
|
||||
test29<S, SV>();
|
||||
test30<S, SV>();
|
||||
test31<S, SV>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S, SV>());
|
||||
// static_assert(test1<S, SV>());
|
||||
// static_assert(test2<S, SV>());
|
||||
// static_assert(test3<S, SV>());
|
||||
// static_assert(test4<S, SV>());
|
||||
// static_assert(test5<S, SV>());
|
||||
// static_assert(test6<S, SV>());
|
||||
// static_assert(test7<S, SV>());
|
||||
// static_assert(test8<S, SV>());
|
||||
// static_assert(test9<S, SV>());
|
||||
// static_assert(test10<S, SV>());
|
||||
// static_assert(test11<S, SV>());
|
||||
// static_assert(test12<S, SV>());
|
||||
// static_assert(test13<S, SV>());
|
||||
// static_assert(test14<S, SV>());
|
||||
// static_assert(test15<S, SV>());
|
||||
// static_assert(test16<S, SV>());
|
||||
// static_assert(test17<S, SV>());
|
||||
// static_assert(test18<S, SV>());
|
||||
// static_assert(test19<S, SV>());
|
||||
// static_assert(test20<S, SV>());
|
||||
// static_assert(test21<S, SV>());
|
||||
// static_assert(test22<S, SV>());
|
||||
// static_assert(test23<S, SV>());
|
||||
// static_assert(test24<S, SV>());
|
||||
// static_assert(test25<S, SV>());
|
||||
// static_assert(test26<S, SV>());
|
||||
// static_assert(test27<S, SV>());
|
||||
// static_assert(test28<S, SV>());
|
||||
// static_assert(test29<S, SV>());
|
||||
// static_assert(test30<S, SV>());
|
||||
// static_assert(test31<S, SV>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test<std::string, std::string_view>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>,
|
||||
std::basic_string_view<char, std::char_traits<char>>>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -47,9 +47,8 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, "", S(""));
|
||||
test(S(""), 0, "12345", S("12345"));
|
||||
@@ -131,9 +130,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, "", S(""));
|
||||
test(S(""), 0, "12345", S("12345"));
|
||||
@@ -215,10 +214,10 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test inserting into self
|
||||
{ // test inserting into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -232,7 +231,17 @@ int main(int, char**)
|
||||
|
||||
s_long.insert(0, s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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)
|
||||
{
|
||||
@@ -48,9 +48,8 @@ test(S s, typename S::size_type pos, const typename S::value_type* str,
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, "", 0, S(""));
|
||||
test(S(""), 0, "12345", 0, S(""));
|
||||
@@ -372,9 +371,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, "", 0, S(""));
|
||||
test(S(""), 0, "12345", 0, S(""));
|
||||
@@ -696,10 +695,10 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test inserting into self
|
||||
{ // test inserting into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -713,7 +712,17 @@ int main(int, char**)
|
||||
|
||||
s_long.insert(0, s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n,
|
||||
typename S::value_type str, S expected)
|
||||
{
|
||||
@@ -48,9 +48,8 @@ test(S s, typename S::size_type pos, typename S::size_type n,
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, 0, '1', S(""));
|
||||
test(S(""), 0, 5, '1', S("11111"));
|
||||
@@ -132,9 +131,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, 0, '1', S(""));
|
||||
test(S(""), 0, 5, '1', S("11111"));
|
||||
@@ -216,7 +215,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -47,9 +47,8 @@ test(S s, typename S::size_type pos, S str, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), 0, S(""), S(""));
|
||||
test(S(""), 0, S("12345"), S("12345"));
|
||||
@@ -131,9 +130,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), 0, S(""), S(""));
|
||||
test(S(""), 0, S("12345"), S("12345"));
|
||||
@@ -215,16 +214,26 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s.insert(0, {"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
|
||||
typename S::size_type n, S expected)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S expected)
|
||||
{
|
||||
const typename S::size_type old_size = s.size();
|
||||
@@ -81,7 +81,7 @@ test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S
|
||||
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, S(""), 0, 0, S(""));
|
||||
test(S(""), 0, S(""), 0, 1, S(""));
|
||||
@@ -133,10 +133,12 @@ void test0()
|
||||
test(S(""), 0, S("1234567890"), 10, 0, S(""));
|
||||
test(S(""), 0, S("1234567890"), 10, 1, S(""));
|
||||
test(S(""), 0, S("1234567890"), 11, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S(""), 0, S("12345678901234567890"), 0, 0, S(""));
|
||||
test(S(""), 0, S("12345678901234567890"), 0, 1, S("1"));
|
||||
@@ -188,10 +190,12 @@ void test1()
|
||||
test(S(""), 1, S("12345"), 5, 0, S("can't happen"));
|
||||
test(S(""), 1, S("12345"), 5, 1, S("can't happen"));
|
||||
test(S(""), 1, S("12345"), 6, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S(""), 1, S("1234567890"), 0, 0, S("can't happen"));
|
||||
test(S(""), 1, S("1234567890"), 0, 1, S("can't happen"));
|
||||
@@ -243,10 +247,12 @@ void test2()
|
||||
test(S(""), 1, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, S(""), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 0, S(""), 0, 1, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcde"), 0, S(""), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, S("12345"), 0, 0, S("abcde"));
|
||||
@@ -298,10 +304,12 @@ void test3()
|
||||
test(S("abcde"), 0, S("1234567890"), 11, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, S("12345678901234567890"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 0, S("12345678901234567890"), 0, 1, S("1abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcde"), 0, S("12345678901234567890"), 0, 10, S("1234567890abcde"));
|
||||
test(S("abcde"), 0, S("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
|
||||
@@ -353,10 +361,12 @@ void test4()
|
||||
test(S("abcde"), 1, S("12345"), 6, 0, S("can't happen"));
|
||||
test(S("abcde"), 1, S("1234567890"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 1, S("1234567890"), 0, 1, S("a1bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcde"), 1, S("1234567890"), 0, 5, S("a12345bcde"));
|
||||
test(S("abcde"), 1, S("1234567890"), 0, 9, S("a123456789bcde"));
|
||||
@@ -408,10 +418,12 @@ void test5()
|
||||
test(S("abcde"), 2, S(""), 0, 1, S("abcde"));
|
||||
test(S("abcde"), 2, S(""), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 2, S("12345"), 0, 0, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcde"), 2, S("12345"), 0, 1, S("ab1cde"));
|
||||
test(S("abcde"), 2, S("12345"), 0, 2, S("ab12cde"));
|
||||
@@ -463,10 +475,12 @@ void test6()
|
||||
test(S("abcde"), 2, S("12345678901234567890"), 0, 1, S("ab1cde"));
|
||||
test(S("abcde"), 2, S("12345678901234567890"), 0, 10, S("ab1234567890cde"));
|
||||
test(S("abcde"), 2, S("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcde"), 2, S("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
|
||||
test(S("abcde"), 2, S("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
|
||||
@@ -518,10 +532,12 @@ void test7()
|
||||
test(S("abcde"), 4, S("1234567890"), 0, 1, S("abcd1e"));
|
||||
test(S("abcde"), 4, S("1234567890"), 0, 5, S("abcd12345e"));
|
||||
test(S("abcde"), 4, S("1234567890"), 0, 9, S("abcd123456789e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcde"), 4, S("1234567890"), 0, 10, S("abcd1234567890e"));
|
||||
test(S("abcde"), 4, S("1234567890"), 0, 11, S("abcd1234567890e"));
|
||||
@@ -573,10 +589,12 @@ void test8()
|
||||
test(S("abcde"), 5, S("12345"), 0, 0, S("abcde"));
|
||||
test(S("abcde"), 5, S("12345"), 0, 1, S("abcde1"));
|
||||
test(S("abcde"), 5, S("12345"), 0, 2, S("abcde12"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test9()
|
||||
TEST_CONSTEXPR_CXX20 bool test9()
|
||||
{
|
||||
test(S("abcde"), 5, S("12345"), 0, 4, S("abcde1234"));
|
||||
test(S("abcde"), 5, S("12345"), 0, 5, S("abcde12345"));
|
||||
@@ -628,10 +646,12 @@ void test9()
|
||||
test(S("abcde"), 5, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
|
||||
test(S("abcde"), 5, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
|
||||
test(S("abcde"), 5, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test10()
|
||||
TEST_CONSTEXPR_CXX20 bool test10()
|
||||
{
|
||||
test(S("abcde"), 5, S("12345678901234567890"), 1, 0, S("abcde"));
|
||||
test(S("abcde"), 5, S("12345678901234567890"), 1, 1, S("abcde2"));
|
||||
@@ -683,10 +703,12 @@ void test10()
|
||||
test(S("abcde"), 6, S("1234567890"), 0, 9, S("can't happen"));
|
||||
test(S("abcde"), 6, S("1234567890"), 0, 10, S("can't happen"));
|
||||
test(S("abcde"), 6, S("1234567890"), 0, 11, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test11()
|
||||
TEST_CONSTEXPR_CXX20 bool test11()
|
||||
{
|
||||
test(S("abcde"), 6, S("1234567890"), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 6, S("1234567890"), 1, 1, S("can't happen"));
|
||||
@@ -738,10 +760,12 @@ void test11()
|
||||
test(S("abcdefghij"), 0, S("12345"), 0, 2, S("12abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345"), 0, 4, S("1234abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345"), 0, 5, S("12345abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test12()
|
||||
TEST_CONSTEXPR_CXX20 bool test12()
|
||||
{
|
||||
test(S("abcdefghij"), 0, S("12345"), 0, 6, S("12345abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345"), 1, 0, S("abcdefghij"));
|
||||
@@ -793,10 +817,12 @@ void test12()
|
||||
test(S("abcdefghij"), 0, S("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 1, S("2abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test13()
|
||||
TEST_CONSTEXPR_CXX20 bool test13()
|
||||
{
|
||||
test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
|
||||
@@ -848,10 +874,12 @@ void test13()
|
||||
test(S("abcdefghij"), 1, S("1234567890"), 0, 11, S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, S("1234567890"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, S("1234567890"), 1, 1, S("a2bcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test14()
|
||||
TEST_CONSTEXPR_CXX20 bool test14()
|
||||
{
|
||||
test(S("abcdefghij"), 1, S("1234567890"), 1, 4, S("a2345bcdefghij"));
|
||||
test(S("abcdefghij"), 1, S("1234567890"), 1, 8, S("a23456789bcdefghij"));
|
||||
@@ -903,10 +931,12 @@ void test14()
|
||||
test(S("abcdefghij"), 5, S("12345"), 0, 5, S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345"), 0, 6, S("abcde12345fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345"), 1, 0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test15()
|
||||
TEST_CONSTEXPR_CXX20 bool test15()
|
||||
{
|
||||
test(S("abcdefghij"), 5, S("12345"), 1, 1, S("abcde2fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345"), 1, 2, S("abcde23fghij"));
|
||||
@@ -958,10 +988,12 @@ void test15()
|
||||
test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 1, S("abcde2fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test16()
|
||||
TEST_CONSTEXPR_CXX20 bool test16()
|
||||
{
|
||||
test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
|
||||
test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
|
||||
@@ -1013,10 +1045,12 @@ void test16()
|
||||
test(S("abcdefghij"), 9, S("1234567890"), 1, 1, S("abcdefghi2j"));
|
||||
test(S("abcdefghij"), 9, S("1234567890"), 1, 4, S("abcdefghi2345j"));
|
||||
test(S("abcdefghij"), 9, S("1234567890"), 1, 8, S("abcdefghi23456789j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test17()
|
||||
TEST_CONSTEXPR_CXX20 bool test17()
|
||||
{
|
||||
test(S("abcdefghij"), 9, S("1234567890"), 1, 9, S("abcdefghi234567890j"));
|
||||
test(S("abcdefghij"), 9, S("1234567890"), 1, 10, S("abcdefghi234567890j"));
|
||||
@@ -1068,10 +1102,12 @@ void test17()
|
||||
test(S("abcdefghij"), 10, S("12345"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, S("12345"), 1, 1, S("abcdefghij2"));
|
||||
test(S("abcdefghij"), 10, S("12345"), 1, 2, S("abcdefghij23"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test18()
|
||||
TEST_CONSTEXPR_CXX20 bool test18()
|
||||
{
|
||||
test(S("abcdefghij"), 10, S("12345"), 1, 3, S("abcdefghij234"));
|
||||
test(S("abcdefghij"), 10, S("12345"), 1, 4, S("abcdefghij2345"));
|
||||
@@ -1123,10 +1159,12 @@ void test18()
|
||||
test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
|
||||
test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
|
||||
test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test19()
|
||||
TEST_CONSTEXPR_CXX20 bool test19()
|
||||
{
|
||||
test(S("abcdefghij"), 10, S("12345678901234567890"), 10, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, S("12345678901234567890"), 10, 1, S("abcdefghij1"));
|
||||
@@ -1178,10 +1216,12 @@ void test19()
|
||||
test(S("abcdefghij"), 11, S("1234567890"), 1, 8, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, S("1234567890"), 1, 9, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, S("1234567890"), 1, 10, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test20()
|
||||
TEST_CONSTEXPR_CXX20 bool test20()
|
||||
{
|
||||
test(S("abcdefghij"), 11, S("1234567890"), 5, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, S("1234567890"), 5, 1, S("can't happen"));
|
||||
@@ -1233,10 +1273,12 @@ void test20()
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test21()
|
||||
TEST_CONSTEXPR_CXX20 bool test21()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
@@ -1288,10 +1330,12 @@ void test21()
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test22()
|
||||
TEST_CONSTEXPR_CXX20 bool test22()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
|
||||
@@ -1343,10 +1387,12 @@ void test22()
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test23()
|
||||
TEST_CONSTEXPR_CXX20 bool test23()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
|
||||
@@ -1398,10 +1444,12 @@ void test23()
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test24()
|
||||
TEST_CONSTEXPR_CXX20 bool test24()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
|
||||
@@ -1453,10 +1501,12 @@ void test24()
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test25()
|
||||
TEST_CONSTEXPR_CXX20 bool test25()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
|
||||
@@ -1508,10 +1558,12 @@ void test25()
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test26()
|
||||
TEST_CONSTEXPR_CXX20 bool test26()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
|
||||
@@ -1563,10 +1615,12 @@ void test26()
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test27()
|
||||
TEST_CONSTEXPR_CXX20 bool test27()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
|
||||
@@ -1618,10 +1672,12 @@ void test27()
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test28()
|
||||
TEST_CONSTEXPR_CXX20 bool test28()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
|
||||
@@ -1673,10 +1729,12 @@ void test28()
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 4, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 5, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 6, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test29()
|
||||
TEST_CONSTEXPR_CXX20 bool test29()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 9, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 9, 1, S("can't happen"));
|
||||
@@ -1708,10 +1766,12 @@ void test29()
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 20, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 20, 1, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test30()
|
||||
TEST_CONSTEXPR_CXX20 bool test30()
|
||||
{
|
||||
test_npos(S(""), 0, S("12345678901234567890"), 0, S("12345678901234567890"));
|
||||
test_npos(S(""), 0, S("12345678901234567890"), 1, S( "2345678901234567890"));
|
||||
@@ -1725,79 +1785,84 @@ void test30()
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 3, S("abcdefghij45klmnopqrst"));
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 5, S("abcdefghijklmnopqrst"));
|
||||
test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 6, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S>());
|
||||
// static_assert(test1<S>());
|
||||
// static_assert(test2<S>());
|
||||
// static_assert(test3<S>());
|
||||
// static_assert(test4<S>());
|
||||
// static_assert(test5<S>());
|
||||
// static_assert(test6<S>());
|
||||
// static_assert(test7<S>());
|
||||
// static_assert(test8<S>());
|
||||
// static_assert(test9<S>());
|
||||
// static_assert(test10<S>());
|
||||
// static_assert(test11<S>());
|
||||
// static_assert(test12<S>());
|
||||
// static_assert(test13<S>());
|
||||
// static_assert(test14<S>());
|
||||
// static_assert(test15<S>());
|
||||
// static_assert(test16<S>());
|
||||
// static_assert(test17<S>());
|
||||
// static_assert(test18<S>());
|
||||
// static_assert(test19<S>());
|
||||
// static_assert(test20<S>());
|
||||
// static_assert(test21<S>());
|
||||
// static_assert(test22<S>());
|
||||
// static_assert(test23<S>());
|
||||
// static_assert(test24<S>());
|
||||
// static_assert(test25<S>());
|
||||
// static_assert(test26<S>());
|
||||
// static_assert(test27<S>());
|
||||
// static_assert(test28<S>());
|
||||
// static_assert(test29<S>());
|
||||
// static_assert(test30<S>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
}
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
}
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
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();
|
||||
@@ -47,9 +47,8 @@ test(S s, typename S::size_type pos, SV sv, S expected)
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test(S(""), 0, SV(""), S(""));
|
||||
@@ -132,9 +131,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::string_view SV;
|
||||
test(S(""), 0, SV(""), S(""));
|
||||
@@ -217,10 +216,10 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test inserting into self
|
||||
{ // test inserting into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -234,7 +233,17 @@ int main(int, char**)
|
||||
|
||||
s_long.insert(0, s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::value_type str, S expected)
|
||||
{
|
||||
s += str;
|
||||
@@ -25,23 +25,32 @@ test(S s, typename S::value_type str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), 'a', S("a"));
|
||||
test(S("12345"), 'a', S("12345a"));
|
||||
test(S("1234567890"), 'a', S("1234567890a"));
|
||||
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), 'a', S("a"));
|
||||
test(S("12345"), 'a', S("12345a"));
|
||||
test(S("1234567890"), 'a', S("1234567890a"));
|
||||
test(S("12345678901234567890"), 'a', S("12345678901234567890a"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,19 +18,28 @@
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
bool test() {
|
||||
{
|
||||
std::string s("123");
|
||||
s += {'a', 'b', 'c'};
|
||||
assert(s == "123abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s += {'a', 'b', 'c'};
|
||||
assert(s == "123abc");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::string s("123");
|
||||
s += {'a', 'b', 'c'};
|
||||
assert(s == "123abc");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123");
|
||||
s += {'a', 'b', 'c'};
|
||||
assert(s == "123abc");
|
||||
}
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, const typename S::value_type* str, S expected)
|
||||
{
|
||||
s += str;
|
||||
@@ -25,9 +25,8 @@ test(S s, const typename S::value_type* str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -49,9 +48,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -73,7 +72,17 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s += str;
|
||||
@@ -26,9 +26,8 @@ test(S s, S str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -50,9 +49,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -74,16 +73,26 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s += {"abc", 1};
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -18,19 +18,28 @@
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
bool test() {
|
||||
{
|
||||
std::string s("123def456");
|
||||
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123def456");
|
||||
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::string s("123def456");
|
||||
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s("123def456");
|
||||
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
|
||||
assert(s == "123abc456");
|
||||
}
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "test_iterators.h"
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S expected)
|
||||
{
|
||||
typename S::size_type old_size = s.size();
|
||||
@@ -39,7 +39,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex
|
||||
struct Widget { operator char() const { throw 42; } };
|
||||
|
||||
template <class S, class It>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l)
|
||||
{
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
@@ -66,7 +66,7 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
|
||||
const char* str = "12345678901234567890";
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, str, str+0, S(""));
|
||||
test(S(""), 0, 0, str, str+0, S(""));
|
||||
@@ -168,10 +168,12 @@ void test0()
|
||||
test(S("abcde"), 1, 0, str, str+0, S("abcde"));
|
||||
test(S("abcde"), 1, 0, str, str+1, S("a1bcde"));
|
||||
test(S("abcde"), 1, 0, str, str+2, S("a12bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 1, 0, str, str+4, S("a1234bcde"));
|
||||
test(S("abcde"), 1, 0, str, str+5, S("a12345bcde"));
|
||||
@@ -273,10 +275,12 @@ void test1()
|
||||
test(S("abcde"), 2, 1, str, str+5, S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, str, str+0, S("abde"));
|
||||
test(S("abcde"), 2, 1, str, str+1, S("ab1de"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcde"), 2, 1, str, str+5, S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, str, str+9, S("ab123456789de"));
|
||||
@@ -378,10 +382,12 @@ void test2()
|
||||
test(S("abcdefghij"), 0, 0, str, str+9, S("123456789abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, str, str+10, S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, str, str+0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 0, str, str+1, S("1abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, str, str+10, S("1234567890abcdefghij"));
|
||||
@@ -483,10 +489,12 @@ void test3()
|
||||
test(S("abcdefghij"), 1, 1, str, str+10, S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, str, str+19, S("a1234567890123456789cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, str, str+20, S("a12345678901234567890cdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, str, str+0, S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, str, str+0, S("afghij"));
|
||||
@@ -588,10 +596,12 @@ void test4()
|
||||
test(S("abcdefghij"), 5, 4, str, str+0, S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, str, str+1, S("abcde1j"));
|
||||
test(S("abcdefghij"), 5, 4, str, str+2, S("abcde12j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 4, str, str+4, S("abcde1234j"));
|
||||
test(S("abcdefghij"), 5, 4, str, str+5, S("abcde12345j"));
|
||||
@@ -693,10 +703,12 @@ void test5()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+0, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+1, S("1bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+9, S("123456789bcdefghijklmnopqrst"));
|
||||
@@ -798,10 +810,12 @@ void test6()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+9, S("a123456789klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+10, S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+0, S("aklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+1, S("a1klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+10, S("a1234567890klmnopqrst"));
|
||||
@@ -903,10 +917,12 @@ void test7()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, str, str+10, S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, str, str+19, S("abcdefghij1234567890123456789t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, str, str+20, S("abcdefghij12345678901234567890t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij"));
|
||||
@@ -972,39 +988,14 @@ void test8()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, str, str+10, S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, str, str+19, S("abcdefghijklmnopqrst1234567890123456789"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, str, str+20, S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
}
|
||||
#endif
|
||||
template <class S>
|
||||
bool test9() {
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{ // test iterator operations that throw
|
||||
typedef std::string S;
|
||||
{ // test iterator operations that throw
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef cpp17_input_iterator<TIter> IIter;
|
||||
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
@@ -1018,11 +1009,10 @@ int main(int, char**)
|
||||
|
||||
Widget w[100];
|
||||
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, w, w+100);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
{ // test replacing into self
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
@@ -1035,10 +1025,9 @@ int main(int, char**)
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
{ // test assigning a different type
|
||||
const uint8_t pc[] = "ABCD";
|
||||
uint8_t p[] = "EFGH";
|
||||
|
||||
@@ -1049,7 +1038,44 @@ int main(int, char**)
|
||||
s.clear();
|
||||
s.replace(s.begin(), s.end(), p, p + 4);
|
||||
assert(s == "EFGH");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S>());
|
||||
// static_assert(test1<S>());
|
||||
// static_assert(test2<S>());
|
||||
// static_assert(test3<S>());
|
||||
// static_assert(test4<S>());
|
||||
// static_assert(test5<S>());
|
||||
// static_assert(test6<S>());
|
||||
// static_assert(test7<S>());
|
||||
// static_assert(test8<S>());
|
||||
// static_assert(test9<S>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -36,7 +36,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
@@ -141,7 +141,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, "", S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij"));
|
||||
@@ -246,7 +246,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345"));
|
||||
@@ -266,24 +266,23 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -297,7 +296,17 @@ int main(int, char**)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str,
|
||||
typename S::size_type n2, S expected)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", 0, S(""));
|
||||
test(S(""), 0, 0, "12345", 0, S(""));
|
||||
@@ -137,10 +137,12 @@ void test0()
|
||||
test(S("abcde"), 1, 0, "12345", 0, S("abcde"));
|
||||
test(S("abcde"), 1, 0, "12345", 1, S("a1bcde"));
|
||||
test(S("abcde"), 1, 0, "12345", 2, S("a12bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 1, 0, "12345", 4, S("a1234bcde"));
|
||||
test(S("abcde"), 1, 0, "12345", 5, S("a12345bcde"));
|
||||
@@ -242,10 +244,12 @@ void test1()
|
||||
test(S("abcde"), 2, 1, "12345", 5, S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", 0, S("abde"));
|
||||
test(S("abcde"), 2, 1, "1234567890", 1, S("ab1de"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcde"), 2, 1, "1234567890", 5, S("ab12345de"));
|
||||
test(S("abcde"), 2, 1, "1234567890", 9, S("ab123456789de"));
|
||||
@@ -347,10 +351,12 @@ void test2()
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", 9, S("123456789abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "1234567890", 10, S("1234567890abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", 0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", 1, S("1abcdefghij"));
|
||||
test(S("abcdefghij"), 0, 0, "12345678901234567890", 10, S("1234567890abcdefghij"));
|
||||
@@ -452,10 +458,12 @@ void test3()
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", 10, S("a1234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", 19, S("a1234567890123456789cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, "", 0, S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, "12345", 0, S("afghij"));
|
||||
@@ -557,10 +565,12 @@ void test4()
|
||||
test(S("abcdefghij"), 5, 4, "12345", 0, S("abcdej"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", 1, S("abcde1j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", 2, S("abcde12j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 4, "12345", 4, S("abcde1234j"));
|
||||
test(S("abcdefghij"), 5, 4, "12345", 5, S("abcde12345j"));
|
||||
@@ -662,10 +672,12 @@ void test5()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 5, S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 0, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 1, S("1bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 5, S("12345bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 9, S("123456789bcdefghijklmnopqrst"));
|
||||
@@ -767,10 +779,12 @@ void test6()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 9, S("a123456789klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 10, S("a1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 0, S("aklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 1, S("a1klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 10, S("a1234567890klmnopqrst"));
|
||||
@@ -872,10 +886,12 @@ void test7()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 10, S("abcdefghij1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 19, S("abcdefghij1234567890123456789t"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 20, S("abcdefghij12345678901234567890t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "", 0, S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 0, S("abcdefghij"));
|
||||
@@ -941,52 +957,61 @@ void test8()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
bool test9() {
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S>());
|
||||
// static_assert(test1<S>());
|
||||
// static_assert(test2<S>());
|
||||
// static_assert(test3<S>());
|
||||
// static_assert(test4<S>());
|
||||
// static_assert(test5<S>());
|
||||
// static_assert(test6<S>());
|
||||
// static_assert(test7<S>());
|
||||
// static_assert(test8<S>());
|
||||
// static_assert(test9<S>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
}
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
}
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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)
|
||||
{
|
||||
@@ -265,21 +265,30 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -34,7 +34,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
@@ -139,7 +139,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
|
||||
@@ -244,7 +244,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
|
||||
@@ -264,30 +264,39 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s = " ";
|
||||
s.replace(s.cbegin(), s.cend(), {"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
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();
|
||||
@@ -34,7 +34,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expecte
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
@@ -139,7 +139,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
|
||||
test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
|
||||
@@ -244,7 +244,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
|
||||
@@ -264,23 +264,32 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::string_view SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", S(""));
|
||||
test(S(""), 0, 0, "12345", S("12345"));
|
||||
@@ -158,7 +158,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, "", S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345", S("can't happen"));
|
||||
@@ -263,7 +263,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
|
||||
@@ -363,21 +363,30 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", S("can't happen"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
const typename S::value_type* str, typename S::size_type n2,
|
||||
S expected)
|
||||
@@ -54,7 +54,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, "", 0, S(""));
|
||||
test(S(""), 0, 0, "12345", 0, S(""));
|
||||
@@ -156,10 +156,12 @@ void test0()
|
||||
test(S("abcde"), 0, 4, "12345", 0, S("e"));
|
||||
test(S("abcde"), 0, 4, "12345", 1, S("1e"));
|
||||
test(S("abcde"), 0, 4, "12345", 2, S("12e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S("abcde"), 0, 4, "12345", 4, S("1234e"));
|
||||
test(S("abcde"), 0, 4, "12345", 5, S("12345e"));
|
||||
@@ -261,10 +263,12 @@ void test1()
|
||||
test(S("abcde"), 1, 3, "12345", 5, S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", 0, S("ae"));
|
||||
test(S("abcde"), 1, 3, "1234567890", 1, S("a1e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S("abcde"), 1, 3, "1234567890", 5, S("a12345e"));
|
||||
test(S("abcde"), 1, 3, "1234567890", 9, S("a123456789e"));
|
||||
@@ -366,10 +370,12 @@ void test2()
|
||||
test(S("abcde"), 2, 3, "1234567890", 9, S("ab123456789"));
|
||||
test(S("abcde"), 2, 3, "1234567890", 10, S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", 0, S("ab"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", 1, S("ab1"));
|
||||
test(S("abcde"), 2, 3, "12345678901234567890", 10, S("ab1234567890"));
|
||||
@@ -471,10 +477,12 @@ void test3()
|
||||
test(S("abcde"), 5, 1, "12345678901234567890", 10, S("abcde1234567890"));
|
||||
test(S("abcde"), 5, 1, "12345678901234567890", 19, S("abcde1234567890123456789"));
|
||||
test(S("abcde"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcde"), 6, 0, "", 0, S("can't happen"));
|
||||
test(S("abcde"), 6, 0, "12345", 0, S("can't happen"));
|
||||
@@ -576,10 +584,12 @@ void test4()
|
||||
test(S("abcdefghij"), 0, 11, "12345", 0, S(""));
|
||||
test(S("abcdefghij"), 0, 11, "12345", 1, S("1"));
|
||||
test(S("abcdefghij"), 0, 11, "12345", 2, S("12"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 11, "12345", 4, S("1234"));
|
||||
test(S("abcdefghij"), 0, 11, "12345", 5, S("12345"));
|
||||
@@ -681,10 +691,12 @@ void test5()
|
||||
test(S("abcdefghij"), 1, 10, "12345", 5, S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", 0, S("a"));
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", 1, S("a1"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", 5, S("a12345"));
|
||||
test(S("abcdefghij"), 1, 10, "1234567890", 9, S("a123456789"));
|
||||
@@ -786,10 +798,12 @@ void test6()
|
||||
test(S("abcdefghij"), 5, 6, "1234567890", 9, S("abcde123456789"));
|
||||
test(S("abcdefghij"), 5, 6, "1234567890", 10, S("abcde1234567890"));
|
||||
test(S("abcdefghij"), 5, 6, "12345678901234567890", 0, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 6, "12345678901234567890", 1, S("abcde1"));
|
||||
test(S("abcdefghij"), 5, 6, "12345678901234567890", 10, S("abcde1234567890"));
|
||||
@@ -891,10 +905,12 @@ void test7()
|
||||
test(S("abcdefghij"), 11, 0, "12345678901234567890", 10, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345678901234567890", 19, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, "12345678901234567890", 20, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 0, S("abcdefghijklmnopqrst"));
|
||||
@@ -996,10 +1012,12 @@ void test8()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 1, S("a1bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 2, S("a12bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test9()
|
||||
TEST_CONSTEXPR_CXX20 bool test9()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 4, S("a1234bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 5, S("a12345bcdefghijklmnopqrst"));
|
||||
@@ -1101,10 +1119,12 @@ void test9()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 5, S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 1, S("abcdefghij1klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test10()
|
||||
TEST_CONSTEXPR_CXX20 bool test10()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 5, S("abcdefghij12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 9, S("abcdefghij123456789klmnopqrst"));
|
||||
@@ -1206,10 +1226,12 @@ void test10()
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 9, S("abcdefghijklmnopqrs123456789t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test11()
|
||||
TEST_CONSTEXPR_CXX20 bool test11()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
|
||||
@@ -1295,41 +1317,46 @@ void test11()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 10, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 19, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 20, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S>());
|
||||
// static_assert(test1<S>());
|
||||
// static_assert(test2<S>());
|
||||
// static_assert(test3<S>());
|
||||
// static_assert(test4<S>());
|
||||
// static_assert(test5<S>());
|
||||
// static_assert(test6<S>());
|
||||
// static_assert(test7<S>());
|
||||
// static_assert(test8<S>());
|
||||
// static_assert(test9<S>());
|
||||
// static_assert(test10<S>());
|
||||
// static_assert(test11<S>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
}
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
}
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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)
|
||||
@@ -54,7 +54,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, 0, '2', S(""));
|
||||
test(S(""), 0, 0, 5, '2', S("22222"));
|
||||
@@ -159,7 +159,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, 0, '2', S("can't happen"));
|
||||
test(S("abcde"), 6, 0, 5, '2', S("can't happen"));
|
||||
@@ -264,7 +264,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '2', S("22222abcdefghijklmnopqrst"));
|
||||
@@ -364,8 +364,7 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, 20, '2', S("can't happen"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
@@ -381,5 +380,15 @@ int main(int, char**)
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
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();
|
||||
@@ -52,7 +52,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, S(""), S(""));
|
||||
test(S(""), 0, 0, S("12345"), S("12345"));
|
||||
@@ -157,7 +157,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, S(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345"), S("can't happen"));
|
||||
@@ -262,7 +262,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
@@ -362,30 +362,39 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s = " ";
|
||||
s.replace(0, 1, {"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
S str, typename S::size_type pos2, typename S::size_type n2,
|
||||
S expected)
|
||||
@@ -56,7 +56,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
S str, typename S::size_type pos2,
|
||||
S expected)
|
||||
@@ -91,7 +91,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
|
||||
|
||||
template <class S>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 bool test0()
|
||||
{
|
||||
test(S(""), 0, 0, S(""), 0, 0, S(""));
|
||||
test(S(""), 0, 0, S(""), 0, 1, S(""));
|
||||
@@ -193,10 +193,12 @@ void test0()
|
||||
test(S(""), 0, 1, S("12345"), 5, 0, S(""));
|
||||
test(S(""), 0, 1, S("12345"), 5, 1, S(""));
|
||||
test(S(""), 0, 1, S("12345"), 6, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 bool test1()
|
||||
{
|
||||
test(S(""), 0, 1, S("1234567890"), 0, 0, S(""));
|
||||
test(S(""), 0, 1, S("1234567890"), 0, 1, S("1"));
|
||||
@@ -298,10 +300,12 @@ void test1()
|
||||
test(S(""), 1, 0, S("1234567890"), 11, 0, S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 bool test2()
|
||||
{
|
||||
test(S(""), 1, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
|
||||
test(S(""), 1, 0, S("12345678901234567890"), 0, 19, S("can't happen"));
|
||||
@@ -403,10 +407,12 @@ void test2()
|
||||
test(S("abcde"), 0, 1, S(""), 0, 1, S("bcde"));
|
||||
test(S("abcde"), 0, 1, S(""), 1, 0, S("can't happen"));
|
||||
test(S("abcde"), 0, 1, S("12345"), 0, 0, S("bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test3()
|
||||
TEST_CONSTEXPR_CXX20 bool test3()
|
||||
{
|
||||
test(S("abcde"), 0, 1, S("12345"), 0, 1, S("1bcde"));
|
||||
test(S("abcde"), 0, 1, S("12345"), 0, 2, S("12bcde"));
|
||||
@@ -508,10 +514,12 @@ void test3()
|
||||
test(S("abcde"), 0, 2, S("1234567890"), 0, 1, S("1cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), 0, 5, S("12345cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), 0, 9, S("123456789cde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test4()
|
||||
TEST_CONSTEXPR_CXX20 bool test4()
|
||||
{
|
||||
test(S("abcde"), 0, 2, S("1234567890"), 0, 10, S("1234567890cde"));
|
||||
test(S("abcde"), 0, 2, S("1234567890"), 0, 11, S("1234567890cde"));
|
||||
@@ -613,10 +621,12 @@ void test4()
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 19, S("1234567890123456789e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 20, S("12345678901234567890e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 21, S("12345678901234567890e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test5()
|
||||
TEST_CONSTEXPR_CXX20 bool test5()
|
||||
{
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 0, S("e"));
|
||||
test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 1, S("2e"));
|
||||
@@ -718,10 +728,12 @@ void test5()
|
||||
test(S("abcde"), 0, 6, S("12345"), 0, 2, S("12"));
|
||||
test(S("abcde"), 0, 6, S("12345"), 0, 4, S("1234"));
|
||||
test(S("abcde"), 0, 6, S("12345"), 0, 5, S("12345"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test6()
|
||||
TEST_CONSTEXPR_CXX20 bool test6()
|
||||
{
|
||||
test(S("abcde"), 0, 6, S("12345"), 0, 6, S("12345"));
|
||||
test(S("abcde"), 0, 6, S("12345"), 1, 0, S(""));
|
||||
@@ -823,10 +835,12 @@ void test6()
|
||||
test(S("abcde"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), 1, 0, S("abcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), 1, 1, S("a2bcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test7()
|
||||
TEST_CONSTEXPR_CXX20 bool test7()
|
||||
{
|
||||
test(S("abcde"), 1, 0, S("1234567890"), 1, 4, S("a2345bcde"));
|
||||
test(S("abcde"), 1, 0, S("1234567890"), 1, 8, S("a23456789bcde"));
|
||||
@@ -928,10 +942,12 @@ void test7()
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test8()
|
||||
TEST_CONSTEXPR_CXX20 bool test8()
|
||||
{
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cde"));
|
||||
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 20, S("a2345678901234567890cde"));
|
||||
@@ -1033,10 +1049,12 @@ void test8()
|
||||
test(S("abcde"), 1, 3, S("12345"), 1, 0, S("ae"));
|
||||
test(S("abcde"), 1, 3, S("12345"), 1, 1, S("a2e"));
|
||||
test(S("abcde"), 1, 3, S("12345"), 1, 2, S("a23e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test9()
|
||||
TEST_CONSTEXPR_CXX20 bool test9()
|
||||
{
|
||||
test(S("abcde"), 1, 3, S("12345"), 1, 3, S("a234e"));
|
||||
test(S("abcde"), 1, 3, S("12345"), 1, 4, S("a2345e"));
|
||||
@@ -1138,10 +1156,12 @@ void test9()
|
||||
test(S("abcde"), 1, 4, S("1234567890"), 1, 8, S("a23456789"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), 1, 9, S("a234567890"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), 1, 10, S("a234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test10()
|
||||
TEST_CONSTEXPR_CXX20 bool test10()
|
||||
{
|
||||
test(S("abcde"), 1, 4, S("1234567890"), 5, 0, S("a"));
|
||||
test(S("abcde"), 1, 4, S("1234567890"), 5, 1, S("a6"));
|
||||
@@ -1243,10 +1263,12 @@ void test10()
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 0, S("a"));
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 1, S("a1"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test11()
|
||||
TEST_CONSTEXPR_CXX20 bool test11()
|
||||
{
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 5, S("a12345"));
|
||||
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 9, S("a123456789"));
|
||||
@@ -1348,10 +1370,12 @@ void test11()
|
||||
test(S("abcde"), 2, 1, S("12345"), 1, 4, S("ab2345de"));
|
||||
test(S("abcde"), 2, 1, S("12345"), 1, 5, S("ab2345de"));
|
||||
test(S("abcde"), 2, 1, S("12345"), 2, 0, S("abde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test12()
|
||||
TEST_CONSTEXPR_CXX20 bool test12()
|
||||
{
|
||||
test(S("abcde"), 2, 1, S("12345"), 2, 1, S("ab3de"));
|
||||
test(S("abcde"), 2, 1, S("12345"), 2, 2, S("ab34de"));
|
||||
@@ -1453,10 +1477,12 @@ void test12()
|
||||
test(S("abcde"), 2, 2, S("1234567890"), 5, 1, S("ab6e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), 5, 2, S("ab67e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), 5, 4, S("ab6789e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test13()
|
||||
TEST_CONSTEXPR_CXX20 bool test13()
|
||||
{
|
||||
test(S("abcde"), 2, 2, S("1234567890"), 5, 5, S("ab67890e"));
|
||||
test(S("abcde"), 2, 2, S("1234567890"), 5, 6, S("ab67890e"));
|
||||
@@ -1558,10 +1584,12 @@ void test13()
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 9, S("ab123456789"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 10, S("ab1234567890"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 11, S("ab1234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test14()
|
||||
TEST_CONSTEXPR_CXX20 bool test14()
|
||||
{
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 0, S("ab"));
|
||||
test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 1, S("ab0"));
|
||||
@@ -1663,10 +1691,12 @@ void test14()
|
||||
test(S("abcde"), 4, 0, S("12345"), 2, 2, S("abcd34e"));
|
||||
test(S("abcde"), 4, 0, S("12345"), 2, 3, S("abcd345e"));
|
||||
test(S("abcde"), 4, 0, S("12345"), 2, 4, S("abcd345e"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test15()
|
||||
TEST_CONSTEXPR_CXX20 bool test15()
|
||||
{
|
||||
test(S("abcde"), 4, 0, S("12345"), 4, 0, S("abcde"));
|
||||
test(S("abcde"), 4, 0, S("12345"), 4, 1, S("abcd5e"));
|
||||
@@ -1768,10 +1798,12 @@ void test15()
|
||||
test(S("abcde"), 4, 1, S("1234567890"), 5, 6, S("abcd67890"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), 9, 0, S("abcd"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), 9, 1, S("abcd0"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test16()
|
||||
TEST_CONSTEXPR_CXX20 bool test16()
|
||||
{
|
||||
test(S("abcde"), 4, 1, S("1234567890"), 9, 2, S("abcd0"));
|
||||
test(S("abcde"), 4, 1, S("1234567890"), 10, 0, S("abcd"));
|
||||
@@ -1873,10 +1905,12 @@ void test16()
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 1, S("abcd0"));
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 2, S("abcd0"));
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 0, S("abcd"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test17()
|
||||
TEST_CONSTEXPR_CXX20 bool test17()
|
||||
{
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 1, S("abcd"));
|
||||
test(S("abcde"), 4, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
@@ -1978,10 +2012,12 @@ void test17()
|
||||
test(S("abcde"), 5, 1, S("12345"), 4, 1, S("abcde5"));
|
||||
test(S("abcde"), 5, 1, S("12345"), 4, 2, S("abcde5"));
|
||||
test(S("abcde"), 5, 1, S("12345"), 5, 0, S("abcde"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test18()
|
||||
TEST_CONSTEXPR_CXX20 bool test18()
|
||||
{
|
||||
test(S("abcde"), 5, 1, S("12345"), 5, 1, S("abcde"));
|
||||
test(S("abcde"), 5, 1, S("12345"), 6, 0, S("can't happen"));
|
||||
@@ -2083,10 +2119,12 @@ void test18()
|
||||
test(S("abcde"), 6, 0, S("1234567890"), 10, 0, S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("1234567890"), 10, 1, S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("1234567890"), 11, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test19()
|
||||
TEST_CONSTEXPR_CXX20 bool test19()
|
||||
{
|
||||
test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
|
||||
test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
|
||||
@@ -2188,10 +2226,12 @@ void test19()
|
||||
test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), 0, 0, S("bcdefghij"));
|
||||
test(S("abcdefghij"), 0, 1, S(""), 0, 1, S("bcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test20()
|
||||
TEST_CONSTEXPR_CXX20 bool test20()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 1, S(""), 1, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 1, S("12345"), 0, 0, S("bcdefghij"));
|
||||
@@ -2293,10 +2333,12 @@ void test20()
|
||||
test(S("abcdefghij"), 0, 5, S("12345"), 6, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 0, S("fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 1, S("1fghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test21()
|
||||
TEST_CONSTEXPR_CXX20 bool test21()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 5, S("12345fghij"));
|
||||
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 9, S("123456789fghij"));
|
||||
@@ -2398,10 +2440,12 @@ void test21()
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 1, S("1j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 10, S("1234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 19, S("1234567890123456789j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test22()
|
||||
TEST_CONSTEXPR_CXX20 bool test22()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 20, S("12345678901234567890j"));
|
||||
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 21, S("12345678901234567890j"));
|
||||
@@ -2503,10 +2547,12 @@ void test22()
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), 0, 0, S(""));
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), 0, 1, S("1"));
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), 0, 2, S("12"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test23()
|
||||
TEST_CONSTEXPR_CXX20 bool test23()
|
||||
{
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), 0, 4, S("1234"));
|
||||
test(S("abcdefghij"), 0, 11, S("12345"), 0, 5, S("12345"));
|
||||
@@ -2608,10 +2654,12 @@ void test23()
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 9, S("a123456789bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 10, S("a1234567890bcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test24()
|
||||
TEST_CONSTEXPR_CXX20 bool test24()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 1, S("a2bcdefghij"));
|
||||
@@ -2713,10 +2761,12 @@ void test24()
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 0, S("acdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test25()
|
||||
TEST_CONSTEXPR_CXX20 bool test25()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghij"));
|
||||
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij"));
|
||||
@@ -2818,10 +2868,12 @@ void test25()
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), 0, 5, S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), 0, 6, S("a12345j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), 1, 0, S("aj"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test26()
|
||||
TEST_CONSTEXPR_CXX20 bool test26()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), 1, 1, S("a2j"));
|
||||
test(S("abcdefghij"), 1, 8, S("12345"), 1, 2, S("a23j"));
|
||||
@@ -2923,10 +2975,12 @@ void test26()
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 1, S("a2"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 4, S("a2345"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 8, S("a23456789"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test27()
|
||||
TEST_CONSTEXPR_CXX20 bool test27()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 9, S("a234567890"));
|
||||
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 10, S("a234567890"));
|
||||
@@ -3028,10 +3082,12 @@ void test27()
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test28()
|
||||
TEST_CONSTEXPR_CXX20 bool test28()
|
||||
{
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 0, S("a"));
|
||||
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 1, S("a1"));
|
||||
@@ -3133,10 +3189,12 @@ void test28()
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), 1, 2, S("abcde23ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), 1, 3, S("abcde234ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), 1, 4, S("abcde2345ghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test29()
|
||||
TEST_CONSTEXPR_CXX20 bool test29()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), 1, 5, S("abcde2345ghij"));
|
||||
test(S("abcdefghij"), 5, 1, S("12345"), 2, 0, S("abcdeghij"));
|
||||
@@ -3238,10 +3296,12 @@ void test29()
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 10, S("abcde234567890hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 0, S("abcdehij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 1, S("abcde6hij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test30()
|
||||
TEST_CONSTEXPR_CXX20 bool test30()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 2, S("abcde67hij"));
|
||||
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 4, S("abcde6789hij"));
|
||||
@@ -3343,10 +3403,12 @@ void test30()
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 1, S("abcde1j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 5, S("abcde12345j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 9, S("abcde123456789j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test31()
|
||||
TEST_CONSTEXPR_CXX20 bool test31()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 10, S("abcde1234567890j"));
|
||||
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 11, S("abcde1234567890j"));
|
||||
@@ -3448,10 +3510,12 @@ void test31()
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), 2, 0, S("abcde"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), 2, 1, S("abcde3"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), 2, 2, S("abcde34"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test32()
|
||||
TEST_CONSTEXPR_CXX20 bool test32()
|
||||
{
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), 2, 3, S("abcde345"));
|
||||
test(S("abcdefghij"), 5, 6, S("12345"), 2, 4, S("abcde345"));
|
||||
@@ -3553,10 +3617,12 @@ void test32()
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 4, S("abcdefghi6789j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 5, S("abcdefghi67890j"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 6, S("abcdefghi67890j"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test33()
|
||||
TEST_CONSTEXPR_CXX20 bool test33()
|
||||
{
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 1, S("abcdefghi0j"));
|
||||
@@ -3658,10 +3724,12 @@ void test33()
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 0, S("abcdefghi"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 1, S("abcdefghi0"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test34()
|
||||
TEST_CONSTEXPR_CXX20 bool test34()
|
||||
{
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 2, S("abcdefghi0"));
|
||||
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 20, 0, S("abcdefghi"));
|
||||
@@ -3763,10 +3831,12 @@ void test34()
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), 2, 4, S("abcdefghij345"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), 4, 0, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), 4, 1, S("abcdefghij5"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test35()
|
||||
TEST_CONSTEXPR_CXX20 bool test35()
|
||||
{
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), 4, 2, S("abcdefghij5"));
|
||||
test(S("abcdefghij"), 10, 0, S("12345"), 5, 0, S("abcdefghij"));
|
||||
@@ -3868,10 +3938,12 @@ void test35()
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 1, S("abcdefghij0"));
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 2, S("abcdefghij0"));
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test36()
|
||||
TEST_CONSTEXPR_CXX20 bool test36()
|
||||
{
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 1, S("abcdefghij"));
|
||||
test(S("abcdefghij"), 10, 1, S("1234567890"), 11, 0, S("can't happen"));
|
||||
@@ -3973,10 +4045,12 @@ void test36()
|
||||
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
|
||||
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test37()
|
||||
TEST_CONSTEXPR_CXX20 bool test37()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
|
||||
@@ -4078,10 +4152,12 @@ void test37()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 0, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 1, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 6, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test38()
|
||||
TEST_CONSTEXPR_CXX20 bool test38()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 0, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
|
||||
@@ -4183,10 +4259,12 @@ void test38()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 11, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 0, S("klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 1, S("1klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test39()
|
||||
TEST_CONSTEXPR_CXX20 bool test39()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst"));
|
||||
@@ -4288,10 +4366,12 @@ void test39()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 0, 1, S(""));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 1, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 0, S(""));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test40()
|
||||
TEST_CONSTEXPR_CXX20 bool test40()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 1, S("1"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 2, S("12"));
|
||||
@@ -4393,10 +4473,12 @@ void test40()
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 1, S("1"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 5, S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 9, S("123456789"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test41()
|
||||
TEST_CONSTEXPR_CXX20 bool test41()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 10, S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 11, S("1234567890"));
|
||||
@@ -4498,10 +4580,12 @@ void test41()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test42()
|
||||
TEST_CONSTEXPR_CXX20 bool test42()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
|
||||
@@ -4603,10 +4687,12 @@ void test42()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 2, S("a12klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 4, S("a1234klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 5, S("a12345klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test43()
|
||||
TEST_CONSTEXPR_CXX20 bool test43()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 6, S("a12345klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 0, S("aklmnopqrst"));
|
||||
@@ -4708,10 +4794,12 @@ void test43()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 11, S("a1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 0, S("at"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 1, S("a2t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test44()
|
||||
TEST_CONSTEXPR_CXX20 bool test44()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 4, S("a2345t"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 8, S("a23456789t"));
|
||||
@@ -4813,10 +4901,12 @@ void test44()
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 1, S("a2"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 9, S("a234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test45()
|
||||
TEST_CONSTEXPR_CXX20 bool test45()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
|
||||
@@ -4918,10 +5008,12 @@ void test45()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 1, S("abcdefghij2klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test46()
|
||||
TEST_CONSTEXPR_CXX20 bool test46()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
|
||||
@@ -5023,10 +5115,12 @@ void test46()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test47()
|
||||
TEST_CONSTEXPR_CXX20 bool test47()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 0, S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 1, S("abcdefghij6lmnopqrst"));
|
||||
@@ -5128,10 +5222,12 @@ void test47()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 0, S("abcdefghijpqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 1, S("abcdefghij1pqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test48()
|
||||
TEST_CONSTEXPR_CXX20 bool test48()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst"));
|
||||
@@ -5233,10 +5329,12 @@ void test48()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 4, S("abcdefghij2345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 5, S("abcdefghij2345"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 0, S("abcdefghij"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test49()
|
||||
TEST_CONSTEXPR_CXX20 bool test49()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 1, S("abcdefghij3"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 2, S("abcdefghij34"));
|
||||
@@ -5338,10 +5436,12 @@ void test49()
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 1, S("abcdefghij6"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 2, S("abcdefghij67"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 4, S("abcdefghij6789"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test50()
|
||||
TEST_CONSTEXPR_CXX20 bool test50()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 5, S("abcdefghij67890"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 6, S("abcdefghij67890"));
|
||||
@@ -5443,10 +5543,12 @@ void test50()
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test51()
|
||||
TEST_CONSTEXPR_CXX20 bool test51()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t"));
|
||||
@@ -5548,10 +5650,12 @@ void test51()
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test52()
|
||||
TEST_CONSTEXPR_CXX20 bool test52()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 0, S("abcdefghijklmnopqrs"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
|
||||
@@ -5653,10 +5757,12 @@ void test52()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test53()
|
||||
TEST_CONSTEXPR_CXX20 bool test53()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
|
||||
@@ -5758,10 +5864,12 @@ void test53()
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test54()
|
||||
TEST_CONSTEXPR_CXX20 bool test54()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
@@ -5839,10 +5947,12 @@ void test54()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test55()
|
||||
TEST_CONSTEXPR_CXX20 bool test55()
|
||||
{
|
||||
test_npos(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, S("abcdefghi1234567890"));
|
||||
test_npos(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, S("abcdefghi0"));
|
||||
@@ -5857,129 +5967,134 @@ void test55()
|
||||
test_npos(S("abcdefghij"), 9, 2, S("12345"), 4, S("abcdefghi5"));
|
||||
test_npos(S("abcdefghij"), 9, 2, S("12345"), 5, S("abcdefghi"));
|
||||
test_npos(S("abcdefghij"), 9, 2, S("12345"), 6, S("can't happen"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void test() {
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
test31<S>();
|
||||
test32<S>();
|
||||
test33<S>();
|
||||
test34<S>();
|
||||
test35<S>();
|
||||
test36<S>();
|
||||
test37<S>();
|
||||
test38<S>();
|
||||
test39<S>();
|
||||
test40<S>();
|
||||
test41<S>();
|
||||
test42<S>();
|
||||
test43<S>();
|
||||
test44<S>();
|
||||
test45<S>();
|
||||
test46<S>();
|
||||
test47<S>();
|
||||
test48<S>();
|
||||
test49<S>();
|
||||
test50<S>();
|
||||
test51<S>();
|
||||
test52<S>();
|
||||
test53<S>();
|
||||
test54<S>();
|
||||
test55<S>();
|
||||
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test0<S>());
|
||||
// static_assert(test1<S>());
|
||||
// static_assert(test2<S>());
|
||||
// static_assert(test3<S>());
|
||||
// static_assert(test4<S>());
|
||||
// static_assert(test5<S>());
|
||||
// static_assert(test6<S>());
|
||||
// static_assert(test7<S>());
|
||||
// static_assert(test8<S>());
|
||||
// static_assert(test9<S>());
|
||||
// static_assert(test10<S>());
|
||||
// static_assert(test11<S>());
|
||||
// static_assert(test12<S>());
|
||||
// static_assert(test13<S>());
|
||||
// static_assert(test14<S>());
|
||||
// static_assert(test15<S>());
|
||||
// static_assert(test16<S>());
|
||||
// static_assert(test17<S>());
|
||||
// static_assert(test18<S>());
|
||||
// static_assert(test19<S>());
|
||||
// static_assert(test20<S>());
|
||||
// static_assert(test21<S>());
|
||||
// static_assert(test22<S>());
|
||||
// static_assert(test23<S>());
|
||||
// static_assert(test24<S>());
|
||||
// static_assert(test25<S>());
|
||||
// static_assert(test26<S>());
|
||||
// static_assert(test27<S>());
|
||||
// static_assert(test28<S>());
|
||||
// static_assert(test29<S>());
|
||||
// static_assert(test30<S>());
|
||||
// static_assert(test31<S>());
|
||||
// static_assert(test32<S>());
|
||||
// static_assert(test33<S>());
|
||||
// static_assert(test34<S>());
|
||||
// static_assert(test35<S>());
|
||||
// static_assert(test36<S>());
|
||||
// static_assert(test37<S>());
|
||||
// static_assert(test38<S>());
|
||||
// static_assert(test39<S>());
|
||||
// static_assert(test40<S>());
|
||||
// static_assert(test41<S>());
|
||||
// static_assert(test42<S>());
|
||||
// static_assert(test43<S>());
|
||||
// static_assert(test44<S>());
|
||||
// static_assert(test45<S>());
|
||||
// static_assert(test46<S>());
|
||||
// static_assert(test47<S>());
|
||||
// static_assert(test48<S>());
|
||||
// static_assert(test49<S>());
|
||||
// static_assert(test50<S>());
|
||||
// static_assert(test51<S>());
|
||||
// static_assert(test52<S>());
|
||||
// static_assert(test53<S>());
|
||||
// static_assert(test54<S>());
|
||||
// static_assert(test55<S>());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
test31<S>();
|
||||
test32<S>();
|
||||
test33<S>();
|
||||
test34<S>();
|
||||
test35<S>();
|
||||
test36<S>();
|
||||
test37<S>();
|
||||
test38<S>();
|
||||
test39<S>();
|
||||
test40<S>();
|
||||
test41<S>();
|
||||
test42<S>();
|
||||
test43<S>();
|
||||
test44<S>();
|
||||
test45<S>();
|
||||
test46<S>();
|
||||
test47<S>();
|
||||
test48<S>();
|
||||
test49<S>();
|
||||
test50<S>();
|
||||
test51<S>();
|
||||
test52<S>();
|
||||
test53<S>();
|
||||
test54<S>();
|
||||
test55<S>();
|
||||
}
|
||||
test<std::string>();
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test0<S>();
|
||||
test1<S>();
|
||||
test2<S>();
|
||||
test3<S>();
|
||||
test4<S>();
|
||||
test5<S>();
|
||||
test6<S>();
|
||||
test7<S>();
|
||||
test8<S>();
|
||||
test9<S>();
|
||||
test10<S>();
|
||||
test11<S>();
|
||||
test12<S>();
|
||||
test13<S>();
|
||||
test14<S>();
|
||||
test15<S>();
|
||||
test16<S>();
|
||||
test17<S>();
|
||||
test18<S>();
|
||||
test19<S>();
|
||||
test20<S>();
|
||||
test21<S>();
|
||||
test22<S>();
|
||||
test23<S>();
|
||||
test24<S>();
|
||||
test25<S>();
|
||||
test26<S>();
|
||||
test27<S>();
|
||||
test28<S>();
|
||||
test29<S>();
|
||||
test30<S>();
|
||||
test31<S>();
|
||||
test32<S>();
|
||||
test33<S>();
|
||||
test34<S>();
|
||||
test35<S>();
|
||||
test36<S>();
|
||||
test37<S>();
|
||||
test38<S>();
|
||||
test39<S>();
|
||||
test40<S>();
|
||||
test41<S>();
|
||||
test42<S>();
|
||||
test43<S>();
|
||||
test44<S>();
|
||||
test45<S>();
|
||||
test46<S>();
|
||||
test47<S>();
|
||||
test48<S>();
|
||||
test49<S>();
|
||||
test50<S>();
|
||||
test51<S>();
|
||||
test52<S>();
|
||||
test53<S>();
|
||||
test54<S>();
|
||||
test55<S>();
|
||||
}
|
||||
test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
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();
|
||||
@@ -52,7 +52,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expecte
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test0()
|
||||
TEST_CONSTEXPR_CXX20 void test0()
|
||||
{
|
||||
test(S(""), 0, 0, SV(""), S(""));
|
||||
test(S(""), 0, 0, SV("12345"), S("12345"));
|
||||
@@ -157,7 +157,7 @@ void test0()
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test1()
|
||||
TEST_CONSTEXPR_CXX20 void test1()
|
||||
{
|
||||
test(S("abcde"), 6, 0, SV(""), S("can't happen"));
|
||||
test(S("abcde"), 6, 0, SV("12345"), S("can't happen"));
|
||||
@@ -262,7 +262,7 @@ void test1()
|
||||
}
|
||||
|
||||
template <class S, class SV>
|
||||
void test2()
|
||||
TEST_CONSTEXPR_CXX20 void test2()
|
||||
{
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
|
||||
@@ -362,23 +362,32 @@ void test2()
|
||||
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen"));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
typedef std::string_view SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
typedef std::string_view SV;
|
||||
test0<S, SV>();
|
||||
test1<S, SV>();
|
||||
test2<S, SV>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s1, S s2)
|
||||
{
|
||||
S s1_ = s1;
|
||||
@@ -31,9 +31,8 @@ test(S s1, S s2)
|
||||
assert(s2 == s1_);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), S(""));
|
||||
test(S(""), S("12345"));
|
||||
@@ -51,9 +50,9 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), S(""));
|
||||
test(S(""), S("12345"));
|
||||
@@ -71,7 +70,17 @@ int main(int, char**)
|
||||
test(S("abcdefghijklmnopqrst"), S("12345"));
|
||||
test(S("abcdefghijklmnopqrst"), S("1234567890"));
|
||||
test(S("abcdefghijklmnopqrst"), S("12345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user