[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:
1 parent
e43b1ce4d5
commit
dcffa7d3e1
56 files changed
+2065
-1177
No files matched your search
+20
-11
@@ -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;
|
||||
}
|
||||
+74
-48
@@ -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
-12
@@ -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;
|
||||
}
|
||||
+75
-50
@@ -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;
|
||||
}
|
||||
+16
-7
@@ -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;
|
||||
|
||||
+21
-12
@@ -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
-10
@@ -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;
|
||||
|
||||
+303
-184
File diff suppressed because it is too large.
Load diff
+19
-10
@@ -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;
|
||||
|
||||
+70
-43
@@ -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;
|
||||
|
||||
+15
-6
@@ -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;
|
||||
}
|
||||
+21
-12
@@ -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;
|
||||
|
||||
+291
-176
@@ -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;
|
||||
|
||||
+19
-10
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user