|
|
|
|
@@ -62,18 +62,22 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "aaaaaa");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w(2ull, L'b');
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
|
|
|
|
assert(w == L"bb");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (3) w/ allocator
|
|
|
|
|
std::basic_string s(6ull, 'a', test_allocator<char>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), BStr<char,test_allocator<char>>);
|
|
|
|
|
assert(s == "aaaaaa");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w(2ull, L'b', test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), BStr<wchar_t, test_allocator<wchar_t>>);
|
|
|
|
|
assert(w == L"bb");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (4) w/o allocator
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -81,6 +85,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "bc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -88,6 +93,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win, (TestSizeT)3);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"def");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (4) w/ allocator
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -95,6 +101,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "bc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -102,6 +109,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win, (TestSizeT)3, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"def");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (5) w/o allocator
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -109,6 +117,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "bc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -116,6 +125,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win, (TestSizeT)2, (TestSizeT)3);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"cde");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (5) w/ allocator
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -123,6 +133,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "bc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -130,48 +141,57 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win, (TestSizeT)2, (TestSizeT)3, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"cde");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (6) w/o allocator
|
|
|
|
|
std::basic_string s("abc", (size_t)2);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "ab");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w(L"abcdef", (size_t)3);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
|
|
|
|
assert(w == L"abc");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (6) w/ allocator
|
|
|
|
|
std::basic_string s("abc", (size_t)2, std::allocator<char>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "ab");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
std::char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
std::basic_string w(L"abcdef", (TestSizeT)3, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abc");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (7) w/o allocator
|
|
|
|
|
std::basic_string s("abc");
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w(L"abcdef");
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (7) w/ allocator
|
|
|
|
|
std::basic_string s("abc", std::allocator<char>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
std::char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
std::basic_string w(L"abcdef", test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // (8) w/o allocator
|
|
|
|
|
using It = cpp17_input_iterator<const char*>;
|
|
|
|
|
@@ -181,12 +201,24 @@ int main(int, char**)
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
}
|
|
|
|
|
{ // (8) w/ allocator
|
|
|
|
|
using ExpectW = std::basic_string<wchar_t, std::char_traits<wchar_t>, test_allocator<wchar_t>>;
|
|
|
|
|
using It = cpp17_input_iterator<const wchar_t*>;
|
|
|
|
|
const wchar_t* input = L"abcdef";
|
|
|
|
|
std::basic_string s(It(input), It(input + 3), test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), ExpectW);
|
|
|
|
|
assert(s == L"abc");
|
|
|
|
|
{
|
|
|
|
|
using Expect = std::basic_string<char, std::char_traits<char>, test_allocator<char>>;
|
|
|
|
|
using It = cpp17_input_iterator<const char*>;
|
|
|
|
|
const char* input = "abcdef";
|
|
|
|
|
std::basic_string s(It(input), It(input + 3), test_allocator<char>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), Expect);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
}
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
{
|
|
|
|
|
using ExpectW = std::basic_string<wchar_t, std::char_traits<wchar_t>, test_allocator<wchar_t>>;
|
|
|
|
|
using It = cpp17_input_iterator<const wchar_t*>;
|
|
|
|
|
const wchar_t* input = L"abcdef";
|
|
|
|
|
std::basic_string s(It(input), It(input + 3), test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), ExpectW);
|
|
|
|
|
assert(s == L"abc");
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (9)
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -194,6 +226,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -201,6 +234,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (10)
|
|
|
|
|
const std::string sin("abc");
|
|
|
|
|
@@ -208,6 +242,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -215,6 +250,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(win, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (11)
|
|
|
|
|
std::string sin("abc");
|
|
|
|
|
@@ -222,6 +258,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -229,6 +266,7 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(std::move(win));
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (12)
|
|
|
|
|
std::string sin("abc");
|
|
|
|
|
@@ -236,6 +274,7 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using WStr = std::basic_string<wchar_t,
|
|
|
|
|
constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
@@ -243,24 +282,29 @@ int main(int, char**)
|
|
|
|
|
std::basic_string w(std::move(win), test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (13) w/o allocator
|
|
|
|
|
std::basic_string s({'a', 'b', 'c'});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w({L'a', L'b', L'c'});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
|
|
|
|
assert(w == L"abc");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (13) w/ allocator
|
|
|
|
|
std::basic_string s({'a', 'b', 'c'}, test_allocator<char>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), BStr<char, test_allocator<char>>);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::basic_string w({L'a', L'b', L'c'}, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), BStr<wchar_t, test_allocator<wchar_t>>);
|
|
|
|
|
assert(w == L"abc");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (14) w/o allocator
|
|
|
|
|
std::string_view sv("abc");
|
|
|
|
|
@@ -268,11 +312,13 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using Expect = std::basic_string<wchar_t, constexpr_char_traits<wchar_t>>;
|
|
|
|
|
std::basic_string_view<wchar_t, constexpr_char_traits<wchar_t>> BSV(L"abcdef");
|
|
|
|
|
std::basic_string w(BSV);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), Expect);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (14) w/ allocator
|
|
|
|
|
using ExpectS = std::basic_string<char, std::char_traits<char>, test_allocator<char>>;
|
|
|
|
|
@@ -281,12 +327,14 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), ExpectS);
|
|
|
|
|
assert(s == "abc");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using ExpectW = std::basic_string<wchar_t, constexpr_char_traits<wchar_t>,
|
|
|
|
|
test_allocator<wchar_t>>;
|
|
|
|
|
std::basic_string_view<wchar_t, constexpr_char_traits<wchar_t>> BSV(L"abcdef");
|
|
|
|
|
std::basic_string w(BSV, test_allocator<wchar_t>{});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), ExpectW);
|
|
|
|
|
assert(w == L"abcdef");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (15) w/o allocator
|
|
|
|
|
std::string s0("abc");
|
|
|
|
|
@@ -294,10 +342,12 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
|
|
|
|
assert(s == "b");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
std::wstring w0(L"abcdef");
|
|
|
|
|
std::basic_string w(w0, 2, 2);
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
|
|
|
|
assert(w == L"cd");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
{ // Testing (15) w/ allocator
|
|
|
|
|
using ExpectS = std::basic_string<char, std::char_traits<char>, test_allocator<char>>;
|
|
|
|
|
@@ -306,11 +356,13 @@ int main(int, char**)
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(s), ExpectS);
|
|
|
|
|
assert(s == "b");
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
|
|
|
|
using ExpectW = std::basic_string<wchar_t, std::char_traits<wchar_t>, test_allocator<wchar_t>>;
|
|
|
|
|
ExpectW w0(L"abcdef");
|
|
|
|
|
std::basic_string w(w0, 2, 2, test_allocator<wchar_t>{6});
|
|
|
|
|
ASSERT_SAME_TYPE(decltype(w), ExpectW);
|
|
|
|
|
assert(w == L"cd");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|