text
stringlengths 0
2.2M
|
---|
{
|
Compare_Text compare_text(STR("ABCDEFABCDE"));
|
TextBuffer buffer;
|
Text text(STR("ABCDEFABCDE"), buffer.data(), buffer.size());
|
size_t position1 = compare_text.find_last_of(STR("AZCXE"), 0, 4);
|
size_t position2 = text.find_last_of(STR("AZCXE"), 0, 4);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR("WXYZ"), 4, 3);
|
position2 = text.find_last_of(STR("WXYZ"), 4, 3);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR("ZCXE"), 5, 3);
|
position2 = text.find_last_of(STR("ZCXE"), 5, 3);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR("ZCXE"), 1, 3);
|
position2 = text.find_last_of(STR("ZCXE"), 1, 3);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR("ZCXE"), compare_text.size(), 4);
|
position2 = text.find_last_of(STR("ZCXE"), text.size(), 4);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR("ZCXE"), 100, 4);
|
position2 = text.find_last_of(STR("ZCXE"), 100, 4);
|
CHECK_EQUAL(position1, position2);
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_find_last_of_character_position)
|
{
|
Compare_Text compare_text(STR("ABCDEF"));
|
TextBuffer buffer;
|
Text text(STR("ABCDEF"), buffer.data(), buffer.size());
|
size_t position1 = compare_text.find_last_of(STR('C'));
|
size_t position2 = text.find_last_of(STR('C'));
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR('Z'));
|
position2 = text.find_last_of(STR('Z'));
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR('F'), compare_text.size());
|
position2 = text.find_last_of(STR('F'), text.size());
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR('C'), 3);
|
position2 = text.find_last_of(STR('C'), 3);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR('C'), compare_text.size());
|
position2 = text.find_last_of(STR('C'), text.size());
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_last_of(STR('C'), 100);
|
position2 = text.find_last_of(STR('C'), 100);
|
CHECK_EQUAL(position1, position2);
|
}
|
//*************************************************************************
|
TEST_FIXTURE(SetupFixture, test_find_first_not_of_string_position)
|
{
|
Compare_Text compare_text(STR("ABCDEF"));
|
TextBuffer buffer;
|
Text text(STR("ABCDEF"), buffer.data(), buffer.size());
|
size_t position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")));
|
size_t position2 = text.find_first_not_of(TextT(STR("ZAXB")));
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")));
|
position2 = text.find_first_not_of(TextT(STR("ZAXB")));
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), 3);
|
position2 = text.find_first_not_of(TextT(STR("ZAXB")), 3);
|
CHECK_EQUAL(position1, position2);
|
position1 = compare_text.find_first_not_of(Compare_Text(STR("ZAXB")), compare_text.size());
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.