text stringlengths 0 2.2M |
|---|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_replace_position_length_pointer_n)
|
{
|
// Non-overflow short text.
|
Compare_Text compare_text(short_text.c_str());
|
TextBuffer buffer;
|
Text text(short_text.c_str(), buffer.data(), buffer.size());
|
compare_text.replace(2, 4, Compare_Text(STR("Replace")).c_str(), 5);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, 4, TextT(STR("Replace")).c_str(), 5);
|
bool is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
// Non-overflow short text, npos.
|
compare_text.assign(short_text.c_str());
|
text.assign(short_text.c_str());
|
compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, Text::npos, TextT(STR("Replace")).c_str(), 5);
|
is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
// Overflow short text.
|
compare_text.assign(short_text.c_str());
|
text.assign(short_text.c_str());
|
compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, 4, TextT(STR("Replace with some text")).c_str(), 15);
|
is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text.is_truncated());
|
#endif
|
// Overflow short text, npos.
|
compare_text.assign(short_text.c_str());
|
text.assign(short_text.c_str());
|
compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace with some text")).c_str(), 15);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, Text::npos, TextT(STR("Replace with some text")).c_str(), 15);
|
is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text.is_truncated());
|
#endif
|
// Non-overflow.
|
compare_text.assign(initial_text.c_str());
|
text.assign(initial_text.c_str());
|
compare_text.replace(2, 7, Compare_Text(STR("Replace")).c_str(), 5);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, 7, TextT(STR("Replace")).c_str(), 5);
|
is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
// Non-overflow, npos.
|
compare_text.assign(initial_text.c_str());
|
text.assign(initial_text.c_str());
|
compare_text.replace(2, Compare_Text::npos, Compare_Text(STR("Replace")).c_str(), 5);
|
compare_text.resize(std::min(compare_text.size(), SIZE));
|
text.replace(2, Text::npos, TextT(STR("Replace")).c_str(), 5);
|
is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
// Overflow.
|
compare_text.assign(initial_text.c_str());
|
text.assign(initial_text.c_str());
|
compare_text.replace(2, 4, Compare_Text(STR("Replace with some text")).c_str(), 15);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.