Update package to swift-tools 5.0

This commit is contained in:
hectr 2019-07-14 23:35:02 +02:00
parent b55c0d8e96
commit 5369124c60
5 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.0
import PackageDescription

View File

@ -24,7 +24,7 @@ extension Matrix where Element == Bool {
for (offset, node) in nodes.enumerated() {
if let adjacentNodes = adjacencyDictionary[node] {
for adjacentNode in adjacentNodes {
guard let adjacentIndex = nodes.index(of: adjacentNode) else {
guard let adjacentIndex = nodes.firstIndex(of: adjacentNode) else {
throw Error.indexNotFound(node: adjacentNode, nodes: nodes)
}
matrix[offset][adjacentIndex] = true

View File

@ -168,7 +168,7 @@ public class ElementaryCyclesSearch<Node> {
}
}
if let index = stack.index(of: v) {
if let index = stack.firstIndex(of: v) {
stack.remove(at: index)
}
return f

View File

@ -83,7 +83,7 @@ extension Vector where Element: Equatable {
@discardableResult
func remove(element: Element) -> Bool {
if let index = array.index(of: element) {
if let index = array.firstIndex(of: element) {
array.remove(at: -index.distance(to: 0))
return true
}

View File

@ -31,10 +31,10 @@ final class AdjacencyMatrixShould: XCTestCase {
"IT": ["FR"]]
let nodes = AdjacencyMatrix.getNodes(graph: graph, sort: nil)
let adjacencyMatrix = try! AdjacencyMatrix.getAdjacencyMatrix(nodes: nodes, adjacencyDictionary: graph)
let es = nodes.index(of: "ES")!
let pt = nodes.index(of: "PT")!
let fr = nodes.index(of: "FR")!
let it = nodes.index(of: "IT")!
let es = nodes.firstIndex(of: "ES")!
let pt = nodes.firstIndex(of: "PT")!
let fr = nodes.firstIndex(of: "FR")!
let it = nodes.firstIndex(of: "IT")!
XCTAssertTrue(adjacencyMatrix[es][pt] ?? adjacencyMatrix[pt][es] ?? false)
XCTAssertTrue(adjacencyMatrix[es][fr] ?? adjacencyMatrix[fr][es] ?? false)
XCTAssertTrue(adjacencyMatrix[fr][it] ?? adjacencyMatrix[it][fr] ?? false)