text
stringlengths
0
2.2M
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(text.is_truncated());
CHECK(other_text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_from_literal)
{
TextBuffer buffer;
Text text(buffer.data(), buffer.size());
text = STR("Hello World");
bool is_equal = Equal(std::u16string(STR("Hello World")), text);
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_from_literal_excess)
{
TextBuffer buffer;
Text text(buffer.data(), buffer.size());
text = STR("Hello World There");
bool is_equal = Equal(std::u16string(STR("Hello World")), text);
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(text.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_from_literal_via_interface)
{
TextBuffer buffer;
Text text(buffer.data(), buffer.size());
IText& itext = text;
itext = STR("Hello World");
bool is_equal = Equal(std::u16string(STR("Hello World")), itext);
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!itext.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_from_literal_via_interface_excess)
{
TextBuffer buffer;
Text text(buffer.data(), buffer.size());
IText& itext = text;
itext = STR("Hello World There");
bool is_equal = Equal(std::u16string(STR("Hello World")), itext);
CHECK(is_equal);
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(itext.is_truncated());
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_begin)
{
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
TextBuffer buffer2;
const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size());
CHECK_EQUAL(&text[0], text.begin());
CHECK_EQUAL(&constText[0], constText.begin());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_end)
{
TextBuffer buffer;
Text text(initial_text.c_str(), buffer.data(), buffer.size());
TextBuffer buffer2;
const Text constText(initial_text.c_str(), buffer2.data(), buffer2.size());
CHECK_EQUAL(&text[initial_text.size()], text.end());
CHECK_EQUAL(&constText[initial_text.size()], constText.end());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_up)
{