text stringlengths 0 2.2M |
|---|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_assign_pointer_length_excess)
|
{
|
Compare_Text compare_text(longer_text.c_str());
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.assign(longer_text.c_str(), longer_text.size());
|
compare_text.resize(text.max_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_assign_range)
|
{
|
Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.assign(compare_text.begin(), compare_text.end());
|
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_assign_range_excess)
|
{
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.assign(longer_text.begin(), longer_text.end());
|
CHECK_EQUAL(initial_text.size(), text.size());
|
bool is_equal = Equal(initial_text, text);
|
CHECK(is_equal);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_assign_size_value)
|
{
|
const size_t INITIAL_SIZE = 5;
|
const value_t INITIAL_VALUE = STR('A');
|
std::array<value_t, INITIAL_SIZE> compare_text;
|
compare_text.fill(INITIAL_VALUE);
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.assign(INITIAL_SIZE, INITIAL_VALUE);
|
CHECK(text.size() == INITIAL_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_assign_size_value_excess)
|
{
|
const size_t INITIAL_SIZE = SIZE;
|
const size_t EXCESS_SIZE = SIZE + 1;
|
const value_t INITIAL_VALUE = STR('A');
|
std::array<value_t, INITIAL_SIZE> compare_text;
|
compare_text.fill(INITIAL_VALUE);
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.assign(EXCESS_SIZE, INITIAL_VALUE);
|
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_push_back)
|
{
|
Compare_Text compare_text;
|
TextBuffer buffer;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.