Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(""));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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>();
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "min_allocator.h"

template <class S>
void
TEST_CONSTEXPR_CXX20 void
test(S s1, S s2)
{
S s1_ = s1;
Expand All @@ -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"));
Expand All @@ -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"));
Expand All @@ -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;
Expand Down