1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-19 03:31:32 +03:00
vimr/VimRTests/ScorerTest.swift

33 lines
937 B
Swift
Raw Normal View History

2016-09-04 00:13:52 +03:00
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import XCTest
import Nimble
class ScorerTest: XCTestCase {
2016-09-08 21:16:37 +03:00
func testScore1() {
2016-09-25 18:50:33 +03:00
let pattern = "sw/nvv".replacingOccurrences(of: "/", with: "")
2016-09-04 00:13:52 +03:00
let targets = [
"SwiftNeoVim/NeoVimView.swift",
2016-09-08 21:16:37 +03:00
"build/Release/NeoVimServer.dSYM/Contents/Resources/DWARF/NeoVimServer",
2016-09-25 18:50:33 +03:00
].map { $0.replacingOccurrences(of: "/", with: "") }
2016-09-04 00:13:52 +03:00
expect(Scorer.score(targets[0], pattern: pattern)).to(beGreaterThan(Scorer.score(targets[1], pattern: pattern)))
}
2016-09-08 21:16:37 +03:00
func testScore2() {
let pattern = "nvv"
let targets = [
"NeoVimView.swift",
"NeoVimViewDelegate.swift",
"NeoVimServer",
]
expect(Scorer.score(targets[0], pattern: pattern)).to(beGreaterThan(Scorer.score(targets[1], pattern: pattern)))
expect(Scorer.score(targets[1], pattern: pattern)).to(beGreaterThan(Scorer.score(targets[2], pattern: pattern)))
}
2016-09-04 00:13:52 +03:00
}