text
stringlengths
0
2.2M
CHECK(text.size() == SIZE);
CHECK(!text.empty());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_range_excess)
{
TextBuffer buffer;
Text text(longer_text.begin(), longer_text.end(), buffer.data(), buffer.size());
bool is_equal = Equal(initial_text, text);
CHECK(is_equal);
CHECK(text.size() == SIZE);
CHECK(!text.empty());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_from_literal)
{
TextBuffer buffer;
Text text(STR("Hello World"), buffer.data(), buffer.size());
bool is_equal = Equal(initial_text, text);
CHECK(is_equal);
CHECK(text.size() == SIZE);
CHECK(!text.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_from_string_view)
{
etl::u16string_view view(initial_text.data(), initial_text.size());
TextBuffer buffer;
Text text(view, buffer.data(), buffer.size());
bool is_equal = Equal(initial_text, text);
CHECK(is_equal);
CHECK(text.size() == SIZE);
CHECK(!text.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor)
{
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
TextBuffer buffer2;
Text text2(text, buffer2.data(), buffer2.size());
CHECK(text2 == text);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text2.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor_i)
{
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
IText& itext = text;
TextBuffer buffer2;
Text text2(itext, buffer2.data(), buffer2.size());
CHECK(text2 == text);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text2.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor_excess)
{
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
TextBufferL bufferl;
Text textl(longer_text.c_str(), bufferl.data(), bufferl.size());
TextBuffer buffer2;
Text text2(textl, buffer2.data(), buffer2.size());
CHECK(text2 == text);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(text2.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor_from_truncated)
{
TextBuffer buffer;
Text text(longer_text.c_str(), buffer.data(), buffer.size());