mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 01:11:02 +00:00
[ICU-170] fix tests of lastIndexOf()
X-Commit-URL: https://ssl.icu-project.org/trac/changeset/283
This commit is contained in:
parent
0900d3e293
commit
38cf1f982b
1 changed files with 3 additions and 31 deletions
|
@ -362,44 +362,16 @@ UnicodeStringTest::TestSearching()
|
|||
if (occurrences != 10)
|
||||
errln("indexOf with character & start & end offsets failed: expected to find 10 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 9999;
|
||||
startPos != -1;
|
||||
(startPos = test1.lastIndexOf(test2, startPos)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 6)
|
||||
errln("lastIndexOf failed: expected to find 6 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 32;
|
||||
startPos != -1;
|
||||
(startPos = test1.lastIndexOf(test2, startPos)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 5)
|
||||
errln("lastIndexOf with starting offset failed: expected to find 5 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 32, endPos = 5;
|
||||
startPos != -1;
|
||||
(startPos = test1.lastIndexOf(test2, startPos, startPos - endPos)) != -1 ? ++occurrences : 0)
|
||||
(startPos = test1.lastIndexOf(test2, 5, startPos - 5)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 4)
|
||||
errln("lastIndexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 9999;
|
||||
startPos != -1;
|
||||
(startPos = test1.lastIndexOf(testChar, startPos)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 16)
|
||||
errln("lastIndexOf with character failed: expected to find 16 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 32;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
(startPos = test1.lastIndexOf(testChar, startPos)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 13)
|
||||
errln("lastIndexOf with character & start offset failed: expected to find 13 occurrences, found " + occurrences);
|
||||
|
||||
for ( occurrences = 0, startPos = 32, endPos = 5;
|
||||
startPos != -1 && startPos < test1.size();
|
||||
(startPos = test1.lastIndexOf(testChar, startPos, startPos - endPos)) != -1 ? ++occurrences : 0)
|
||||
startPos != -1;
|
||||
(startPos = test1.lastIndexOf(testChar, 5, startPos - 5)) != -1 ? ++occurrences : 0)
|
||||
;
|
||||
if (occurrences != 11)
|
||||
errln("lastIndexOf with character & start & end offsets failed: expected to find 11 occurrences, found " + occurrences);
|
||||
|
|
Loading…
Add table
Reference in a new issue