text stringlengths 0 2.2M |
|---|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_full_full)
|
{
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.resize(text.max_size(), STR('A'));
|
CHECK(text.full());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_full_half)
|
{
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
text.resize(text.max_size() / 2, STR('A'));
|
CHECK(!text.full());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_full_empty)
|
{
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
CHECK(!text.full());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_index)
|
{
|
Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
Text text(initial_text.c_str(), buffer.data(), buffer.size());
|
for (size_t i = 0UL; i < text.size(); ++i)
|
{
|
CHECK_EQUAL(text[i], compare_text[i]);
|
}
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_index_const)
|
{
|
const Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
const Text text(initial_text.c_str(), buffer.data(), buffer.size());
|
for (size_t i = 0UL; i < text.size(); ++i)
|
{
|
CHECK_EQUAL(text[i], compare_text[i]);
|
}
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_at)
|
{
|
Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
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_at_const)
|
{
|
const Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.