text stringlengths 0 2.2M |
|---|
return os;
|
}
|
//***********************************
|
std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type* c)
|
{
|
os << (void*)c;
|
return os;
|
}
|
SUITE(test_string_char)
|
{
|
static constexpr size_t SIZE = 11;
|
static constexpr size_t SIZE_L = 52;
|
static constexpr size_t SIZE_S = 4;
|
using Text = etl::u16string_ext;
|
using IText = etl::iu16string;
|
using TextT = etl::u16string<SIZE>;
|
using Compare_Text = std::u16string;
|
using value_t = Text::value_type;
|
using TextBuffer = std::array<IText::value_type, SIZE + 1>;
|
using TextBufferL = std::array<IText::value_type, SIZE_L + 1>;
|
using TextBufferS = std::array<IText::value_type, SIZE_S + 1>;
|
Compare_Text initial_text;
|
Compare_Text less_text;
|
Compare_Text greater_text;
|
Compare_Text shorter_text;
|
Compare_Text different_text;
|
Compare_Text insert_text;
|
Compare_Text longer_text;
|
Compare_Text short_text;
|
const value_t* pinitial_text = STR("Hello World");
|
value_t array_text[12];
|
value_t* p_text = array_text;
|
//*************************************************************************
|
template <typename T1, typename T2>
|
bool Equal(const T1& compare_text, const T2& text)
|
{
|
return (compare_text.size() == text.size()) && std::equal(text.begin(), text.end(), compare_text.begin());
|
}
|
//*************************************************************************
|
struct SetupFixture
|
{
|
SetupFixture()
|
{
|
initial_text = STR("Hello World");
|
insert_text = STR("Insert");
|
less_text = STR("Hello Vorld");
|
greater_text = STR("Hello Xorld");
|
shorter_text = STR("Hello Worl");
|
different_text = STR("Byee Planet");
|
longer_text = STR("Hello World There");
|
short_text = STR("Hello");
|
std::copy(pinitial_text, pinitial_text + etl::strlen(pinitial_text), array_text);
|
}
|
};
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_default_constructor)
|
{
|
TextBuffer buffer;
|
Text text(buffer.data(), buffer.size());
|
CHECK_EQUAL(text.size(), size_t(0));
|
CHECK(text.empty());
|
CHECK_EQUAL(SIZE, text.capacity());
|
CHECK_EQUAL(SIZE, text.max_size());
|
CHECK(text.begin() == text.end());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_default_constructor_use_buffer_and_size)
|
{
|
size_t length = etl::strlen(p_text);
|
Text text(p_text, length + 1);
|
CHECK_EQUAL(0U, text.size());
|
CHECK(text.empty());
|
CHECK_EQUAL(length, text.capacity());
|
CHECK_EQUAL(length, text.max_size());
|
CHECK(text.begin() == text.end());
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_default_constructor_use_buffer_text_and_size)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.