mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-09 10:20:59 +00:00
Refs #1071. indexOfObject:inSortedRange:options:usingComparator is incorrectly implemented.
Add more tests to cover more features of the indexOfObject:inSortedRange:options:usingComparator method
This commit is contained in:
1 parent
95a2b46ae1
commit
db6608571a
2 files changed
+67
-7
No files matched your search
@@ -440,13 +440,13 @@ CPBinarySearchingInsertionIndex = 1 << 10;
|
||||
else
|
||||
{
|
||||
if (options & CPBinarySearchingFirstEqual)
|
||||
while (middle++ < count - 1 &&
|
||||
aComparator(anObject, [self objectAtIndex:middle]) === CPOrderedSame);
|
||||
while (middle > first && aComparator(anObject, [self objectAtIndex:middle - 1]) === CPOrderedSame)
|
||||
--middle;
|
||||
|
||||
else if (options & CPBinarySearchingLastEqual)
|
||||
{
|
||||
while (middle-- > 0 &&
|
||||
aComparator(anObject, [self objectAtIndex:middle]) === CPOrderedSame);
|
||||
while (middle < last && aComparator(anObject, [self objectAtIndex:middle + 1]) === CPOrderedSame)
|
||||
++middle;
|
||||
|
||||
if (options & CPBinarySearchingInsertionIndex)
|
||||
++middle;
|
||||
|
||||
Reference in new issue
Block a user