Skip to content

Commit

Permalink
Fix: Swift tests passing (#123)
Browse files Browse the repository at this point in the history
Closes #77 

---------

Co-authored-by: Riyazul555 <[email protected]>
  • Loading branch information
ashvardanian and MdRiyazulIslam authored Mar 21, 2024
1 parent 0431f26 commit 6225324
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions swift/Test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@ class StringZillaTests: XCTestCase {
XCTAssertEqual(testString[index...], "Hello, world! Welcome to StringZilla. 👋")
}

// TODO: This fails!
// func testFindLastCharacterNotFromSet() {
// let index = testString.findLast(characterNotFrom: "aeiou")!
// XCTAssertEqual(testString.distance(from: testString.startIndex, to: index), 38)
// XCTAssertEqual(testString[index...], "👋")
// }
func testFindLastCharacterNotFromSet() {
let index = testString.findLast(characterNotFrom: "aeiou")!
XCTAssertEqual(testString.distance(from: testString.startIndex, to: index), 38)
XCTAssertEqual(testString[index...], "👋")
}

func testEditDistance() {
let otherString = "Hello, world!"
let distance = try? testString.editDistance(from: otherString) // Using try?
let distance = try? testString.editDistance(from: otherString)
XCTAssertNotNil(distance)
XCTAssertEqual(distance, 29)
}

func testFindLastCharacterNotFromSetNoMatch() {
let index = "aeiou".findLast(characterNotFrom: "aeiou")
XCTAssertNil(index)
}
}

0 comments on commit 6225324

Please sign in to comment.