     for j in i..<11 {
       for k in i...j {
         let p = (i..<j).partitionPoint { $0 >= k }
-        expectGE(p, i)
-        expectLE(p, j)
+        expectGE(p, i, "\(p) >= \(i)")
+        expectLE(p, j, "\(p) <= \(j)")
         expectEqual(p, k)
       }
     }

//===--- Stable Partition -------------------------------------------------===//
//===----------------------------------------------------------------------===//

extension Collection
where Self : MutableCollectionAlgorithms {

  @discardableResult
  mutating func stablePartition(
    isSuffixElement: (Element) throws -> Bool
  ) rethrows -> Index {
        return try stablePartition(
            count: count, isSuffixElement: isSuffixElement)
  }

    /// Moves all elements satisfying `isSuffixElement` into a suffix of the collection,
    /// preserving their relative order, returning the start of the resulting suffix.
    ///
    /// - Complexity: O(n) where n is the number of elements.
    /// - Precondition: `n == self.count`
    fileprivate mutating func stablePartition(
        count n: Int, isSuffixElement: (Element) throws-> Bool
    ) rethrows -> Index {
        if n == 0 { return startIndex }
        if n == 1 {
            return try isSuffixElement(self[startIndex]) ? startIndex : endIndex
        }
        let h = n / 2, i = index(startIndex, offsetBy: h)
        let j = try self[..<i].stablePartition(
            count: h, isSuffixElement: isSuffixElement)
        let k = try self[i...].stablePartition(
            count: n - h, isSuffixElement: isSuffixElement)
        return self[j..<k].rotate(shiftingToStart: i)
    }
}

extension Collection {
    func stablyPartitioned(
        isSuffixElement p: (Element) -> Bool
    ) -> [Element] {
        var a = Array(self)
        a.stablePartition(isSuffixElement: p)
        return a
    }
}

extension LazyCollectionProtocol
where Element == Elements.Element {
    func stablyPartitioned(
        isSuffixElement p: (Element) -> Bool
    ) -> LazyCollection<[Element]> {
        return elements.stablyPartitioned(isSuffixElement: p).lazy
    }
}

extension Collection {

  mutating func rotate(shiftingToStart middle: Index) -> Index
}

// Conformances of common collection types to MutableCollectionAlgorithms.
// If rotate was a requirement of MutableCollection, these would not be needed.
extension Array : MutableCollectionAlgorithms {  }
extension ArraySlice : MutableCollectionAlgorithms {  }
extension Slice : MutableCollectionAlgorithms
  where Base: MutableCollection { }

extension MutableCollection {
  /// Swaps the elements of the two given subranges, up to the upper bound of
  /// the smaller subrange. The returned indices are the ends of the two ranges
  /// that were actually swapped.
