text stringlengths 0 2.2M |
|---|
TextBuffer buffer4;
|
const Text shorter(shorter_text.c_str(), buffer4.data(), buffer4.size());
|
CHECK((shorter > initial) == (shorter_text > initial_text));
|
CHECK((initial > shorter) == (initial_text > shorter_text));
|
CHECK((initial > initial) == (initial_text > initial_text));
|
CHECK((initial > initial) == (initial_text > initial_text));
|
// String-Pointer Pointer-String
|
CHECK((less > pinitial_text) == (less_text > pinitial_text));
|
CHECK((pinitial_text > less) == (pinitial_text > less_text));
|
CHECK((greater > pinitial_text) == (greater_text > pinitial_text));
|
CHECK((pinitial_text > greater) == (pinitial_text > greater_text));
|
CHECK((shorter > pinitial_text) == (shorter_text > pinitial_text));
|
CHECK((pinitial_text > shorter) == (pinitial_text > shorter_text));
|
CHECK((initial > pinitial_text) == (initial_text > pinitial_text));
|
CHECK((pinitial_text > initial) == (pinitial_text > initial_text));
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_greater_than_or_equal)
|
{
|
TextBuffer buffer;
|
const Text less(less_text.begin(), less_text.end(), buffer.data(), buffer.size());
|
TextBuffer buffer2;
|
const Text initial(initial_text.begin(), initial_text.end(), buffer2.data(), buffer2.size());
|
// String-String
|
CHECK((less >= initial) == (less_text >= initial_text));
|
CHECK((initial >= less) == (initial_text >= less_text));
|
TextBuffer buffer3;
|
const Text greater(greater_text.begin(), greater_text.end(), buffer3.data(), buffer3.size());
|
CHECK((greater >= initial) == (greater_text >= initial_text));
|
CHECK((initial >= greater) == (initial_text >= greater_text));
|
TextBuffer buffer4;
|
const Text shorter(shorter_text.begin(), shorter_text.end(), buffer4.data(), buffer4.size());
|
CHECK((shorter >= initial) == (shorter_text >= initial_text));
|
CHECK((initial >= shorter) == (initial_text > shorter_text));
|
CHECK((initial >= initial) == (initial_text >= initial_text));
|
CHECK((initial >= initial) == (initial_text >= initial_text));
|
// String-Pointer Pointer-String
|
CHECK((less >= pinitial_text) == (less_text >= pinitial_text));
|
CHECK((pinitial_text >= less) == (pinitial_text >= less_text));
|
CHECK((greater >= pinitial_text) == (greater_text >= pinitial_text));
|
CHECK((pinitial_text >= greater) == (pinitial_text >= greater_text));
|
CHECK((shorter >= pinitial_text) == (shorter_text >= pinitial_text));
|
CHECK((pinitial_text >= shorter) == (pinitial_text >= shorter_text));
|
CHECK((initial >= pinitial_text) == (initial_text >= pinitial_text));
|
CHECK((pinitial_text >= initial) == (pinitial_text >= initial_text));
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_copy)
|
{
|
Compare_Text compare_text(initial_text.c_str());
|
TextBuffer buffer;
|
Text text(initial_text.c_str(), buffer.data(), buffer.size());
|
value_t buffer1[SIZE];
|
value_t buffer2[SIZE];
|
size_t length1 = compare_text.copy(buffer1, 5, 2);
|
buffer1[length1] = STR('\0');
|
size_t length2 = text.copy(buffer2, 5, 2);
|
buffer2[length2] = STR('\0');
|
CHECK_EQUAL(length1, length2);
|
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
|
CHECK(!text.is_truncated());
|
#endif
|
bool is_equal = std::equal(buffer1,
|
buffer1 + length1,
|
buffer2);
|
CHECK(is_equal);
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_copy_start_pos_too_large)
|
{
|
TextBuffer buffer;
|
Text text(initial_text.c_str(), buffer.data(), buffer.size());
|
value_t buffer1[SIZE];
|
size_t length1 = text.copy(buffer1, 5, SIZE);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.