Skip to content

Commit

Permalink
Fix deprecation warnings in SortedArray tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Nov 21, 2024
1 parent 89ba73d commit 02207d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Tests/HandySwiftTests/Structs/SortedArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class SortedArrayTests: XCTestCase {
let emptyArray: [Int] = []
let sortedEmptyArray = SortedArray(emptyArray)

XCTAssertNil(sortedEmptyArray.index { _ in true })
XCTAssertNil(sortedEmptyArray.firstIndex { _ in true })

let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
let sortedIntArray = SortedArray(intArray)

let expectedIndex = 3
let resultingIndex = sortedIntArray.index { $0 >= 3 }
let resultingIndex = sortedIntArray.firstIndex { $0 >= 3 }

XCTAssertEqual(resultingIndex, expectedIndex)
}
Expand All @@ -28,7 +28,7 @@ class SortedArrayTests: XCTestCase {
let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
let sortedIntArray = SortedArray(intArray)

let index = sortedIntArray.index { $0 > 5 }!
let index = sortedIntArray.firstIndex { $0 > 5 }!
let sortedSubArray = sortedIntArray.prefix(upTo: index)

XCTAssertEqual(sortedSubArray.array, [0, 1, 2, 3, 4, 5])
Expand All @@ -38,7 +38,7 @@ class SortedArrayTests: XCTestCase {
let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
let sortedIntArray = SortedArray(intArray)

let index = sortedIntArray.index { $0 > 5 }!
let index = sortedIntArray.firstIndex { $0 > 5 }!
let sortedSubArray = sortedIntArray.suffix(from: index)

XCTAssertEqual(sortedSubArray.array, [6, 7, 8, 9])
Expand Down

0 comments on commit 02207d1

Please sign in to comment.