text stringlengths 0 2.2M |
|---|
TextBuffer buffer2;
|
Text text2(text, buffer2.data(), buffer2.size());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text2.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_construct_position_length)
|
{
|
Compare_Text compare_text(initial_text.c_str());
|
Compare_Text compare_text2(compare_text, 2, 4);
|
TextBuffer buffer;
|
Text text(initial_text.c_str(), buffer.data(), buffer.size());
|
TextBuffer buffer2;
|
Text text2(text, buffer2.data(), buffer2.size(), 2, 4);
|
bool is_equal = Equal(compare_text2, text2);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text2.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_construct_position_length_excess)
|
{
|
Compare_Text compare_text(longer_text.c_str());
|
Compare_Text compare_text2(compare_text, 2, 11);
|
TextBufferL bufferl;
|
Text textl(longer_text.c_str(), bufferl.data(), bufferl.size());
|
TextBuffer buffer;
|
Text text2(textl, buffer.data(), buffer.size(), 2, 12);
|
bool is_equal = Equal(compare_text2, text2);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text2.is_truncated());
|
#endif
|
}
|
#if ETL_USING_INITIALIZER_LIST
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_construct_initializer_list)
|
{
|
Compare_Text compare_text = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') };
|
std::initializer_list<Text::value_type> il = { STR('H'), STR('e'), STR('l') , STR('l') , STR('o') };
|
TextBuffer buffer;
|
Text text(il, buffer.data(), buffer.size());
|
bool is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_construct_initializer_list_excess)
|
{
|
Compare_Text compare_text = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '),
|
STR('W'), STR('o'), STR('r'), STR('l'), STR('d') };
|
std::initializer_list<Text::value_type> il = { STR('H'), STR('e'), STR('l'), STR('l'), STR('o'), STR(' '),
|
STR('W'), STR('o'), STR('r'), STR('l'), STR('d'), STR(' '),
|
STR('T'), STR('h'), STR('e'), STR('r'), STR('e') };
|
TextBuffer buffer;
|
Text text(il, buffer.data(), buffer.size());
|
bool is_equal = Equal(compare_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text.is_truncated());
|
#endif
|
}
|
#endif
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_assignment)
|
{
|
TextBuffer buffer;
|
Text text(initial_text.begin(), initial_text.end(), buffer.data(), buffer.size());
|
TextBuffer buffer2;
|
Text other_text(buffer2.data(), buffer2.size());
|
other_text = text;
|
bool is_equal = Equal(text, other_text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
CHECK(!other_text.is_truncated());
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.