text
stringlengths
0
2.2M
const Text text(initial_text.c_str(), buffer.data(), buffer.size());
for (size_t i = 0UL; i < text.size(); ++i)
{
CHECK_EQUAL(text.at(i), compare_text.at(i));
}
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
CHECK_THROW(text.at(text.size()), etl::string_out_of_bounds);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_front)
{
Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
CHECK(text.front() == compare_text.front());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_front_const)
{
const Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
const Text text(initial_text.c_str(), buffer.data(), buffer.size());
CHECK(text.front() == compare_text.front());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_back)
{
Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
CHECK(text.back() == compare_text.back());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_back_const)
{
const Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
const Text text(initial_text.c_str(), buffer.data(), buffer.size());
CHECK(text.back() == compare_text.back());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_data)
{
Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size());
bool is_equal = std::equal(text.data(),
text.data() + text.size(),
compare_text.begin());
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_data_const)
{
Compare_Text compare_text(initial_text.c_str());
TextBuffer buffer;
const Text text(compare_text.begin(), compare_text.end(), buffer.data(), buffer.size());
bool is_equal = std::equal(text.data(),
text.data() + text.size(),
compare_text.begin());